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

Most upvoted comments

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:

grafik

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].

$ pnpm install -g github-release-from-changelog
 WARN  Refetching C:\Users\Oliver\.pnpm-store\2\registry.npmjs.org\mime\1.6.0 to store, as it was modified
 WARN  Refetching C:\Users\Oliver\.pnpm-store\2\registry.npmjs.org\netrc\0.1.4 to store, as it was modified
 WARN  Refetching C:\Users\Oliver\.pnpm-store\2\registry.npmjs.org\https-proxy-agent\1.0.0 to store, as it was modified
 WARN  Refetching C:\Users\Oliver\.pnpm-store\2\registry.npmjs.org\extend\3.0.1 to store, as it was modified
Adding 19 packages to node_modules
 WARN  EXDEV: cross-device link not permitted, link 'C:\Users\Oliver\.pnpm-store\2\registry.npmjs.org\github-release-from-changelog\1.3.0\node_modules\github-release-from-changelog\package.json' -> 'C:\Program Files\nodejs\pnpm-global\1\node_modules\.registry.npmjs.org\github-release-from-changelog\1.3.0\node_ modules\github-release-from-changelog+stage\package.json'
Falling back to copying packages from store
 ERROR  [object Object]
Resolving: total 20, reused 11, downloaded 5

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 😃

D:\>node -v
v9.0.0

D:\>npm -v
5.5.1

D:\>npm -g ls -depth=0
C:\Users\Ben\AppData\Roaming\npm
`-- (empty)

D:\>npm -g config set store D:\.pnpm-store

D:\>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-v59-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-v59-win32-x64.tar.gz
prebuild-install http request GET https://github.com/resin-io-modules/drivelist/releases/download/v5.2.6/drivelist-v5.2.6-node-v59-win32-x64.tar.gz
prebuild-install http 404 https://github.com/resin-io-modules/drivelist/releases/download/v5.2.6/drivelist-v5.2.6-node-v59-win32-x64.tar.gz
prebuild-install WARN install No prebuilt binaries found (target=9.0.0 runtime=node arch=x64 platform=win32)

C:\Users\Ben\AppData\Roaming\npm\node_modules\pnpm\node_modules\drivelist>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "" rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:483:19)
gyp ERR! stack     at PythonFinder.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:508:16)
gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:166:21)
gyp ERR! System Windows_NT 10.0.15063
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Ben\AppData\Roaming\npm\node_modules\pnpm\node_modules\drivelist
gyp ERR! node -v v9.0.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: drivelist@5.2.6 (node_modules\pnpm\node_modules\drivelist):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: drivelist@5.2.6 install: `prebuild-install || node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1