pnpm: macOS install error EACCES

$ pnpm install -g pnpm
 ERROR  EACCES: permission denied, mkdir '/usr/local/pnpm-global'

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 9
  • Comments: 43 (14 by maintainers)

Commits related to this issue

Most upvoted comments

I started getting the following message whenever running pnpm for installs:

   ╭──────────────────────────────────────────────────────────────────╮
   │                                                                  │
   │                Update available! 2.12.2 → 2.13.1                 │
   │   Changelog: https://github.com/pnpm/pnpm/releases/tag/v2.13.1   │
   │                  Run pnpm i -g pnpm to update!                   │
   │                                                                  │
   │      Follow @pnpmjs for updates: https://twitter.com/pnpmjs      │
   │                                                                  │
   ╰──────────────────────────────────────────────────────────────────╯

However, trying the recommended command resulted in the error in this issue:

$ pnpm i -g pnpm
 ERROR  EACCES: permission denied, mkdir '/usr/local/pnpm-global'

So I have worked around this by manually creating the folder and taking ownership of it:

sudo mkdir '/usr/local/pnpm-global'
sudo chown <myusername> pnpm-global

So it’s working for now. Suggest that this may be a confusing user experience for those following the notification though.

I had a similar problem.

Error: EACCES: permission denied, mkdir '/Users/xxx/.pnpm-store/2/registry.npmjs.org/@types/node/10.12.6/_tmp_96278_4fbf8e00003a2ca4d082c374b8c81a20'

But I’ve found a solution for this sudo rm -rf /Users/xxx/.pnpm-store 😂 and after this everything works perfectly.

Just setting up a new mac, and this time I decided to install pnpm through homebrew.

Now when I try to install any global package

pnpm add -g ts-node
ERROR  EACCES: permission denied, mkdir '/Users/anurag/Library/pnpm'
For help, run: pnpm help add

EDIT:

Ok got the issue, my PNPM_HOME wasn’t set correctly. Just run pnpm setup

This is fixed in pnpm v6

I see, but it tried to write to the user directory, so seems like the fix will work.

Joel Denning notifications@github.com ezt írta (időpont: 2021. febr. 28., V 18:09):

I think my current installation of pnpm might be messed up, as i’ve done some commands with sudo and also manually changed permissions of directories to try to get commands working.

Here’s what happens when I attempt to install that version of pnpm:

~/c/single-spa-workshop.com (main|✚4…) [1] $ curl -L https://unpkg.com/pnpm@6.0.0-20210228/dist/pnpm.js | node - add --global pnpm % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 4409k 0 4409k 0 0 11.6M 0 --:–:-- --:–:-- --:–:-- 11.6M Packages: +1 + Progress: resolved 1, reused 1, downloaded 0, added 0, done ERROR EPERM: operation not permitted, chmod ‘/Users/joeldenning/pnpm-global/5/node_modules/pnpm/bin/pnpm.js’

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/pnpm/pnpm/issues/1203#issuecomment-787475876, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOWTG7WF2Y67F4MLKVTUKTTBJTCDANCNFSM4FDAO4EQ .

I have version 5.5.1 and the problem is still here

For me the following solved the problem: npm config set unsafe-perm true and then run npm install -g pnpm again.

I also ran into this.

$ node --version
v11.1.0

$ npm --version
6.4.1

$ nvm --version
0.33.11

$ pnpm --version
2.17.8

$ npm prefix -g
/usr/local

Doing npm config set prefix $HOME helps, but it also makes NVM stop working.

See here for the related NVM issue.

Easiest way to test is

curl -L https://unpkg.com/pnpm@6.0.0-20210228/dist/pnpm.js | node - add --global pnpm

This seems to work for me, the current installer curl -f https://pnpm.js.org/pnpm.js | node - add --global pnpm throws the same error

curl -f https://pnpm.js.org/pnpm.js | node - add --global pnpm
 ERROR  EACCES: permission denied, mkdir '/usr/local/pnpm-global'

However even with the new script upgrading still throws an error

pnpm add -g pnpm
 ERROR  EACCES: permission denied, mkdir '/usr/local/pnpm-global'

As a workaround, I can do pnpm install -g foo --prefix $HOME so that NVM keeps working.

I think NVM is the problem here, at least in my case. I should be able to set prefix to whatever I wish, and NVM should not complain.

yes, I think pnpm should write to a folder where it has access already. There should not be any additional steps from users.