pnpm: EPERM: operation not permitted, chmod

pnpm version: 6.14.2

Code to reproduce the issue:

 ERROR  EPERM: operation not permitted, chmod '/Users/hronro/Projects/my-project/node_modules/.pnpm/rimraf@3.0.2/node_modules/rimraf/bin.js'
at pnpm/rimraf

Additional information:

  • node -v prints: v16.6.2
  • Windows, macOS, or Linux?: macOS

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 5
  • Comments: 37 (8 by maintainers)

Most upvoted comments

This may be related: https://github.com/pnpm/pnpm/issues/2343#issuecomment-893486787

I had an issue where mkdirp@1.0.4/node_modules/mkdirp/bin/cmd.js ended up with root:wheel ownership. That caused me to get ERROR  EPERM: operation not permitted, chmod ‘/path/to/my/project/node_modules/mkdirp/bin/cmd.js’ when attempting to pnpm install. Running rm -rf node_modules in my project and reinstalling the package didn’t fix it nor did trying to pnpm install mkdirp in a new/empty test project, but rm -rf node_modules && rm -rf $HOME/.pnpm-store and then reinstalling did fix it. So my guess is some files in that package had gotten corrupted in the store somehow.

I use sudo pnpm install resolve it

@zkochan I fixed this by deleting the whole pnpm global cache directory. I guess there are some files with incorrect permissions in the global cache directory.

After i deleted the /Users/${user}/.pnpm-store directory, re-run pnpm i in my project and it worked.
May be this command really needs. #2343

What command were you running?

I got this whenever I run pnpm i

After i deleted the /Users/${user}/.pnpm-store directory, re-run pnpm i in my project and it worked. May be this command really needs. #2343

For me in windows, I had to remove the pnpm folder on the %USERPROFILE%\AppData\Local path and the installing it again using npm i -g pnpm

@Bosphoramus That fixed it for me on linux. Thanks

fixed this problem after running pnpm store prune See: https://pnpm.io/cli/store

deleting the whole pnpm global cache directory.

ok but how did you do that?