Pnpm: macOS install error EACCES

Created on 3 Jun 2018  ยท  27Comments  ยท  Source: pnpm/pnpm

$ pnpm install -g pnpm
โ€‰ERRORโ€‰ EACCES: permission denied, mkdir '/usr/local/pnpm-global'
macOS 2 bug bugetting-started

Most helpful comment

I have version 5.5.1 and the problem is still here

All 27 comments

related #928 (similar issue on Windows)

Why does it need access to this directory? Can this be fixed without editing permissions?

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

I agree

@quinton-ashley I need your help because I don't have a macOS

what does this print? npm root -g and this npm prefix -g?

also, check the content of the npmrc file installed in the root of the globally installed npm. It should contain prefix=<some path>

Hi @zkochan I have come across this issue too so here are my answers to your question from 25 June, hopefully this can help you progress a fix to this issue.

npm root -g prints:
/usr/local/lib/node_modules

npm prefix -g prints:
/usr/local
And that is the same value in the npmrc file too.

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

if NVM creates some env variable that contains the global prefix, we can read that variable and install pnpm to that location

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.

You can also set the pnpm-prefix config to change the location of global pnpm
pnpm install -g foo --pnpm-prefix $HOME

@zkochan Is that another workaround, or is there some nuance I'm missing?

edit: Looks like I get an error when trying it:

$ pnpm i -g lerna --pnpm-prefix $HOME
The "path" argument must be of type string. Received type boolean

I ended up patching NVM myself as a workaround (see here).

edit: Here was my real problem: link

Does installing via curl -L https://unpkg.com/@pnpm/self-installer | node work correctly?

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.

I'm having the same problem:.pnpm-store is owned by the root user.
I think the problem is that npm requires sudo to install the pnpm cli, so the permissions may be an artifact of that situation

I used this solution and trust me it works

I tried re-installing pnpm and then again updating it but the error persists:

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

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

@Flo3719 worked for me too, is it necessary to do npm config set unsafe-perm false after all?

@Flo3719 - Thanks! finally this worked for me too
npm config set unsafe-perm true

Any solution to this? Making it unusable for me as I cannot install it without sudo.

This should work in the latest pnpm.

Try to install v5.2.9 and then update it to the latest through pnpm add -g pnpm

I have version 5.5.1 and the problem is still here

what error do you get? no additional info?

what error do you get? no additional info?

โ€‰ERRORโ€‰ EACCES: permission denied, mkdir '/usr/local/pnpm-global'

what error do you get? no additional info?

โ€‰ERRORโ€‰ EACCES: permission denied, mkdir '/usr/local/pnpm-global'

please let me know which info you would like to get to help you to solve the issue

Was this page helpful?
0 / 5 - 0 ratings

Related issues

KSXGitHub picture KSXGitHub  ยท  37Comments

nickpape picture nickpape  ยท  40Comments

zkochan picture zkochan  ยท  35Comments

aecz picture aecz  ยท  33Comments

zkochan picture zkochan  ยท  58Comments