prettier: Unable to run prettier 3.0.0 with error node_modules/.bin/prettier: Permission denied
Environments:
- Prettier Version: 3.0.0
- Running Prettier via: pnpm, npx, etc… doesn’t appear to matter.
- Runtime: pnpm 7.14.1, node 16.16.0
- Operating System: macOS
- Prettier plugins (if any):
Steps to reproduce:
Install prettier as per the docs (in my case pnpm)): https://prettier.io/docs/en/install.html
Expected behavior:
npx prettier
should run.
Actual behavior:
Executing:
npx prettier
Yields: sh: /Users/mrmagoo/Development/mobile/react-native-app/node_modules/.bin/prettier: Permission denied
Looking at the premissions of ./bin.prettier:
lrwxr-xr-x 1 mrmagoo staff 28 Jul 27 18:12 node_modules/.bin/prettier -> ../prettier/bin/prettier.cjs
...
-rw-r--r-- 2 mrmagoo staff 2.1K Jul 25 12:55 node_modules/prettier/bin/prettier.cjs
If i grant execute permissions to node_modules/prettier/bin/prettier.cjs
it all works as expected.
About this issue
- Original URL
- State: open
- Created a year ago
- Reactions: 5
- Comments: 17 (9 by maintainers)
I think this happened to me couple times after prettier got updated in our repo. The fix was to remove
node_modules/.bin/prettier
and runyarn
againI’ve been seeing this recently with prettier installed via yarn. I wonder if https://github.com/yarnpkg/berry/issues/5344 is at fault.
uninstall and reinstall, solve it.
We have test for it. https://github.com/prettier/prettier/blob/6ed37ad85731e4e62d81481d40dfd98c6a675a10/tests/integration/__tests__/cli.js#L6