Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows: Cannot update global npm version after using setup-node #411

Closed
1 of 5 tasks
peterjuras opened this issue Jan 29, 2022 · 11 comments
Closed
1 of 5 tasks

Windows: Cannot update global npm version after using setup-node #411

peterjuras opened this issue Jan 29, 2022 · 11 comments
Assignees
Labels
bug Something isn't working

Comments

@peterjuras
Copy link

Description:
Up until now, updating the global npm version after setting up the node version using npm install -g npm worked on all operating systems without issues.

Now I'm receiving the following errors:

npm ERR! code EPERM
npm ERR! syscall rename
npm ERR! path C:\npm\prefix\node_modules\npm\node_modules\.node-gyp.DELETE\node_modules\@tootallnate
npm ERR! dest C:\npm\prefix\node_modules\npm\node_modules\node-gyp\node_modules\@tootallnate
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, rename 'C:\npm\prefix\node_modules\npm\node_modules\.node-gyp.DELETE\node_modules\@tootallnate' -> 'C:\npm\prefix\node_modules\npm\node_modules\node-gyp\node_modules\@tootallnate'
npm ERR!  [OperationalError: EPERM: operation not permitted, rename 'C:\npm\prefix\node_modules\npm\node_modules\.node-gyp.DELETE\node_modules\@tootallnate' -> 'C:\npm\prefix\node_modules\npm\node_modules\node-gyp\node_modules\@tootallnate'] {
npm ERR!   cause: [Error: EPERM: operation not permitted, rename 'C:\npm\prefix\node_modules\npm\node_modules\.node-gyp.DELETE\node_modules\@tootallnate' -> 'C:\npm\prefix\node_modules\npm\node_modules\node-gyp\node_modules\@tootallnate'] {
npm ERR!     errno: -4048,
npm ERR!     code: 'EPERM',
npm ERR!     syscall: 'rename',
npm ERR!     path: 'C:\\npm\\prefix\\node_modules\\npm\\node_modules\\.node-gyp.DELETE\\node_modules\\@tootallnate',
npm ERR!     dest: 'C:\\npm\\prefix\\node_modules\\npm\\node_modules\\node-gyp\\node_modules\\@tootallnate'
npm ERR!   },
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'rename',
npm ERR!   path: 'C:\\npm\\prefix\\node_modules\\npm\\node_modules\\.node-gyp.DELETE\\node_modules\\@tootallnate',
npm ERR!   dest: 'C:\\npm\\prefix\\node_modules\\npm\\node_modules\\node-gyp\\node_modules\\@tootallnate',
npm ERR!   parent: 'npm'
npm ERR! }
npm ERR! 
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR! 
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\npm\cache\_logs\2022-01-29T07_32_14_023Z-debug.log

Action version:
2.5.1 (pinned at @2)

Platform:

  • Ubuntu
  • macOS
  • Windows

Runner type:

  • Hosted
  • Self-hosted

Tools version:
Trying to set up node 12, likely also an issue with other node versions.

Repro steps:

You can see an example action run here. The failed workflow runs npm install -g npm after using the setup-node action, the passing run runs it without using the setup-node action.

Workflow configuration used in the example above:

name: github-actions-windows-npm-install-test
on:
  push:
jobs:
  win-setup-node-action:
    name: "WIN: Global npm install with setup-node action"
    runs-on: windows-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v2
        with:
          node-version: 12
      - name: Install latest npm version
        run: npm install --global npm
  win-preinstalled-node:
    name: "WIN: Global npm install without setup-node action"
    runs-on: windows-latest
    steps:
      - uses: actions/checkout@v2
      - name: Install latest npm version
        run: npm install --global npm

Expected behavior:

npm install -g npm should globally install the newest npm version and overwrite the default version that comes with node 12, 14 etc.

Actual behavior:

npm install -g npm fails due to permissions errors on Windows and breaks the workflow run.

@peterjuras peterjuras added bug Something isn't working needs triage labels Jan 29, 2022
peterjuras added a commit to coat-dev/coat that referenced this issue Jan 29, 2022
Updating the global npm version on Windows is currently broken due to a bug in the `setup-node` action.
See actions/setup-node#411 for more details.
E2E tests on Windows are run on the pre-installed version of node and npm until the bug is fixed.
@matt5Github
Copy link

matt5Github commented Jan 29, 2022

I am getting same error while updating global npm to latest version.

C:\Users\Test\AppData\Roaming\npm>npm install -g npm@latest
npm ERR! path C:\Users\Test\AppData\Roaming\npm\node_modules\npm\node_modules.node-gyp.DELETE\node_modules@tootallnate
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall rename
npm ERR! Error: EPERM: operation not permitted, rename 'C:\Users\Test\AppData\Roaming\npm\node_modules\npm\node_modules.node-gyp.DELETE\node_modules@tootallnate' -> 'C:\Users\Test\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\node_modules@tootallnate'
npm ERR! { Error: EPERM: operation not permitted, rename 'C:\Users\Test\AppData\Roaming\npm\node_modules\npm\node_modules.node-gyp.DELETE\node_modules@tootallnate' -> 'C:\Users\Test\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\node_modules@tootallnate'
npm ERR! cause:
npm ERR! { Error: EPERM: operation not permitted, rename 'C:\Users\Test\AppData\Roaming\npm\node_modules\npm\node_modules.node-gyp.DELETE\node_modules@tootallnate' -> 'C:\Users\Test\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\node_modules@tootallnate'
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'rename',
npm ERR! path: 'C:\Users\Test\AppData\Roaming\npm\node_modules\npm\node_modules\.node-gyp.DELETE\node_modules\@TooTallNate',
npm ERR! dest: 'C:\Users\Test\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\node_modules\@TooTallNate' },
npm ERR! stack: 'Error: EPERM: operation not permitted, rename 'C:\Users\Test\AppData\Roaming\npm\node_modules\npm\node_modules\.node-gyp.DELETE\node_modules\@TooTallNate' -> 'C:\Users\Test\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\node_modules\@TooTallNate'',
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'rename',
npm ERR! path: 'C:\Users\Test\AppData\Roaming\npm\node_modules\npm\node_modules\.node-gyp.DELETE\node_modules\@TooTallNate',
npm ERR! dest: 'C:\Users\Test\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\node_modules\@TooTallNate',
npm ERR! parent: 'npm' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Test\AppData\Roaming\npm-cache_logs\2022-01-29T17_06_44_945Z-debug.log

C:\Users\Test\AppData\Roaming\npm>

Herschel added a commit to Herschel/ruffle that referenced this issue Jan 29, 2022
Test is currently broken because of this issue:
actions/setup-node#411
Herschel added a commit to ruffle-rs/ruffle that referenced this issue Jan 29, 2022
Test is currently broken because of this issue:
actions/setup-node#411
@dmitry-shibanov
Copy link
Contributor

Hello everyone. Thank you for your report. I think it should be related to this issue. As a workaround for now you can specify npm version as 8.3.1.

      - name: Install latest npm version
        run: npm install --global npm@8.3.1

@willemmulder
Copy link

willemmulder commented Feb 3, 2022

I have the same problem, and fixing the version to 8.3.1 worked for me. Thanks!

rictic added a commit to runem/lit-analyzer that referenced this issue Feb 3, 2022
* Disable testing node 14 on Windows

See: actions/setup-node#411

* Fix exclude in workflow.yml

* Also exclude node 12
AbhyudayaSharma added a commit to AbhyudayaSharma/abhyudayasharma.github.io that referenced this issue Feb 4, 2022
@michael-strother-wth
Copy link

I ran into the same issue... installing 8.3.1 as a workaround worked for me.

@DahirWarsame
Copy link

I had the same issue. After running the npm install -g npm@latest command I got the same error.

C:/WINDOWS/system32 via 🦀
❯ npm install -g npm@latest
npm WARN npm npm does not support Node.js v14.15.1
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 6, 8, 9, 10, 11, 12.
npm WARN npm You can find the latest version at https://nodejs.org/
npm ERR! path C:\Users\<userName>\AppData\Roaming\npm\node_modules\npm\node_modules\.node-gyp.DELETE\node_modules\@tootallnate
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall rename
npm ERR! Error: EPERM: operation not permitted, rename 'C:\Users\<userName>\AppData\Roaming\npm\node_modules\npm\node_modules\.node-gyp.DELETE\node_modules\@tootallnate' -> 'C:\Users\<userName>\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\node_modules\@tootallnate'
npm ERR!  [OperationalError: EPERM: operation not permitted, rename 'C:\Users\<userName>\AppData\Roaming\npm\node_modules\npm\node_modules\.node-gyp.DELETE\node_modules\@tootallnate' -> 'C:\Users\<userName>\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\node_modules\@tootallnate'] {
npm ERR!   cause: [Error: EPERM: operation not permitted, rename 'C:\Users\<userName>\AppData\Roaming\npm\node_modules\npm\node_modules\.node-gyp.DELETE\node_modules\@tootallnate' -> 'C:\Users\<userName>\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\node_modules\@tootallnate'] {
npm ERR!     errno: -4048,
npm ERR!     code: 'EPERM',
npm ERR!     syscall: 'rename',
npm ERR!     path: 'C:\\Users\\<userName>\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\.node-gyp.DELETE\\node_modules\\@tootallnate',
npm ERR!     dest: 'C:\\Users\\<userName>\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\node_modules\\@tootallnate'
npm ERR!   },
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'rename',
npm ERR!   path: 'C:\\Users\\<userName>\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\.node-gyp.DELETE\\node_modules\\@tootallnate',
npm ERR!   dest: 'C:\\Users\\<userName>\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\node_modules\\@tootallnate',
npm ERR!   parent: 'npm'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\<userName>\AppData\Roaming\npm-cache\_logs\2022-02-09T13_40_57_362Z-debug.log
The batch file cannot be found.

But installing v8.3.1 worked like charm 😁

C:/WINDOWS/system32 via 🦀 took 8s
❯ npm install --global npm@8.3.1
C:\Users\<userName>\AppData\Roaming\npm\npm -> C:\Users\<userName>\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js
C:\Users\<userName>\AppData\Roaming\npm\npx -> C:\Users\<userName>\AppData\Roaming\npm\node_modules\npm\bin\npx-cli.js
+ npm@8.3.1
added 33 packages from 20 contributors and updated 181 packages in 7.559s

C:/WINDOWS/system32 via 🦀 took 8s
❯ npm -v
8.3.1

@Badisi
Copy link

Badisi commented Feb 25, 2022

Installing npm@8.3.1 before attempting to update npm to latest as worked for me.

npm install -g npm@8.3.1
npm install -g npm@latest

@dmitry-shibanov
Copy link
Contributor

Hello everyone. I've tried to update npm version to the latest one and it works as expected. Could please confirm that everything works as expected ?

@dmitry-shibanov dmitry-shibanov self-assigned this Mar 31, 2022
@dmitry-shibanov
Copy link
Contributor

Hello everyone. I'm going to close the issue, because for now it works as expected. If you have any concerns feel free to ping us.

@mmomtchev
Copy link

@dmitry-shibanov this one seems back since today, it is 100% reproducible on Windows with Node.js 14.x: https://github.com/mmomtchev/pymport/actions/runs/3436129129/jobs/5737940944

d-fischer added a commit to cosmiconfig/cosmiconfig that referenced this issue Nov 13, 2022
@peterjuras
Copy link
Author

Opened #623 as a follow up. The issue is also happening again for me.

@Bekarysalashybayev
Copy link

npm install -g npm@9.5.0
worked for me (with special version)

cbartondock added a commit to SteamGridDB/steam-rom-manager that referenced this issue Mar 17, 2023
deining pushed a commit to deining/setup-node that referenced this issue Nov 9, 2023
* fix: re-stage files after pulling

This should fix an issue that prevented changes from being committed
when `git pull --rebase --autostash` used.

Issue actions#406

* chore: mark pre-commit hook as executable

* fix: detect conflicts after pull
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

10 participants