Repository navigation
Node 10, npm gives an EPERM on every operation #20112
Description
Activity
EPERM means "permissions issue." Could be a number of things, from an overzealous virus scanner to wrong file permissions.
- addedwindowsIssues and PRs related to the Windows platform.Issues and PRs related to the Windows platform.npmIssues and PRs related to the npm client dependency or the npm registry.Issues and PRs related to the npm client dependency or the npm registry.
on Apr 17, 2018 - addedquestionIssues asking questions about Node.js.Issues asking questions about Node.js.
on Apr 17, 2018 My guess is wrong file permissions are set by the installer, since Node 9 (both npm 5.6 and 5.8) work as expected. File location doesn't seem to be changed between versions, and this happens consistently on multiple machines, and keeps happening even after an hour.
I can repro the same issue easily. I tried to debug npm, but turns out this is before it even gets to running npm (as can been seen from the stack above, where it's just trying to open the npm-cli.js file to load it).
I have the latest v10.x branch built locally, and stepping through the code it appears to be due to the recent libuv, which is requesting write access to any opened file. As npm (along with the rest of Node.js) is installed under
C:\Program Files, then write access is not granted (unless running with Admin rights).You can see the change causing this here: ae2b5bc#diff-4a14951fd12c46802543f3a8aa54a620R437 . If I comment out that exact line ("
access |= FILE_WRITE_ATTRIBUTES;") and rebuild, npm runs without issue.This seems fundamentally busted on Windows if you can't run npm commands. (Odd/concerning if this has been in the v10.x branch for 15 days without being caught!)
cc @nodejs/libuv @nodejs/platform-windows
Corresponding libuv PR: libuv/libuv#1777
cc @bzoz
Can reproduce on Windows 7 x64.
- Create simple
test.jsfile, then forbid write access via file property dialog (this should not be simple read-only property, but a security permission change). - This file can be run by all current releases from v4 till v9.
- Last Nightly and v8-canary give
EPERM: operation not permitted.
- Create simple
- addedconfirmed-bugIssues and PRs for confirmed bugs.Issues and PRs for confirmed bugs.and removedquestionIssues asking questions about Node.js.Issues asking questions about Node.js.
on Apr 17, 2018 cc @jasnell as this can block v10 release.
- addedlibuvIssues and PRs related to the libuv dependency or the uv binding.Issues and PRs related to the libuv dependency or the uv binding.
on Apr 18, 2018 - added a commit that references this issue
on Apr 18, 2018 13 remaining items
Reopening until the libuv update lands here :)
- added a commit that references this issue
on Apr 22, 2018 - added 2 commits that reference this issue
on Apr 23, 2018 - added a commit that references this issue
on Apr 26, 2018 - added a commit that references this issue
on Aug 7, 2018 - added a commit that references this issue
on Jul 27, 2026
Version: v10.0.0-nightly201804175eb9f3c91c
Platform: Windows 10 64-bit and 32-bit
Subsystem: npm
Both node and npm are installed in default location, and on the path.
This works as expected in Node 9, which is why I filed an issue here.
Any npm command results in the following error on several machines: