pnpm: EPERM: operation not permitted, mkdir 'C:\Program Files\nodejs\pnpm-global'
pnpm version: 1.19.3
To reproduce the issue:
C:\>npm -g install pnpm
C:\Users\Ben\AppData\Roaming\npm\pnpx -> C:\Users\Ben\AppData\Roaming\npm\node_modules\pnpm\lib\bin\pnpx.js
C:\Users\Ben\AppData\Roaming\npm\pnpm -> C:\Users\Ben\AppData\Roaming\npm\node_modules\pnpm\lib\bin\pnpm.js
> drivelist@5.2.6 install C:\Users\Ben\AppData\Roaming\npm\node_modules\pnpm\node_modules\drivelist
> prebuild-install || node-gyp rebuild
prebuild-install info begin Prebuild-install version 2.3.0
prebuild-install info looking for local prebuild @ prebuilds\drivelist-v5.2.6-node-v57-win32-x64.tar.gz
prebuild-install info looking for cached prebuild @ C:\Users\Ben\AppData\Roaming\npm-cache\_prebuilds\https-github.com-resin-io-modules-drivelist-releases-download-v5.2.6-drivelist-v5.2.6-node-v57-win32-x64.tar.gz
prebuild-install info found cached prebuild
prebuild-install info unpacking @ C:\Users\Ben\AppData\Roaming\npm-cache\_prebuilds\https-github.com-resin-io-modules-drivelist-releases-download-v5.2.6-drivelist-v5.2.6-node-v57-win32-x64.tar.gz
prebuild-install info unpack resolved to C:\Users\Ben\AppData\Roaming\npm\node_modules\pnpm\node_modules\drivelist\build\Release\drivelist.node
prebuild-install info unpack required C:\Users\Ben\AppData\Roaming\npm\node_modules\pnpm\node_modules\drivelist\build\Release\drivelist.node successfully
prebuild-install info install Successfully installed prebuilt binary!
+ pnpm@1.19.3
added 574 packages in 63.807s
C:\>pnpm -g install less
ERROR EPERM: operation not permitted, mkdir 'C:\Program Files\nodejs\pnpm-global'
fs.js:648
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^
Error: EPERM: operation not permitted, open 'C:\pnpm-debug.log'
at Object.fs.openSync (fs.js:648:18)
at Object.fs.writeFileSync (fs.js:1293:33)
at process.on (C:\Users\Ben\AppData\Roaming\npm\node_modules\pnpm\node_modules\pnpm-file-reporter\lib\index.js:24:12)
at emitOne (events.js:120:20)
at process.emit (events.js:210:7)
at processEmit [as emit] (C:\Users\Ben\AppData\Roaming\npm\node_modules\pnpm\node_modules\signal-exit\index.js:149:35)
In fact, whatever I try gives the same error!
There is no C:\Users\Ben\.pnpm-store
folder and pnpm-debug.log
file is nowhere to be found
Additional information:
node -v
prints: v8.8.0- Windows, OS X, or Linux?: Windows 10 x64
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 20 (5 by maintainers)
Commits related to this issue
- fix: install global packages to APPDATA close #928 — committed to pnpm/pnpm by zkochan 6 years ago
- fix: install global packages to APPDATA close #928 — committed to pnpm/pnpm by zkochan 6 years ago
Insecure workaround
Proposed workaround. Since
pnpm install -g
also needs access to\Program Files\nodejs
, it seems to be most easy to move the nodejs installation.Sorry for German screenshots - short story: Just give all users write access to the
nodejs
folder:Secure workaround - without the ability to add new executables
Update: This does not work, because of https://github.com/pnpm/pnpm/issues/712. I think, the fix does not work “correctly” with symlinks. As admin:
mkdir d:\.pnpm-store\
,c:
,cd "\Program Files\nodejs\"
,mklink /D pnpm-global d:\.pnpm-store\
WARN EXDEV: cross-device link not permitted, link
. Error not output in human readable form, but just[object Object]
.Global packages should be installed to the <prefix> folder (https://docs.npmjs.com/files/folders#prefix-configuration) #1264
I think I understand the
.npmrc
file in the project root. But I am not sure what I should do for the global part.Anyway in case it is interesting for you, here is the detail - and some drivelist errors - of my last try a few minutes ago 😃