[BUG] executable permissions aren't set if a .bin symlink already exists #4149
Labels
Bug
thing that needs fixing
Needs Triage
needs review for next steps
Release 8.x
work is associated with a specific npm 8 release
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
If a folder within
node_modules
is deleted and npm install is run, npm will not mark any bin files as executable if the symlink to that file still exists innode_modules/.bin
This means that if
node_modules
was only partially cleaned up, the re-install can land in a broken state. We're seeing this happen on CI environments with quirks in the caching / preserving of node_module folders.Expected Behavior
A re-install should also re-update all bin files to have executable permissions.
Steps To Reproduce
npm install
npm start
and you will seeCLI for webpack must be installed.
(indicating that thewebpack
command successfully executed)ls -l node_modules/webpack/bin/webpack.js
and see the permissions-rwxr-xr-x
rm -rf ./node_modules/webpack/
npm install
npm start
and you will seesh: path/to/node_modules/.bin/webpack: Permission denied
ls -l node_modules/webpack/bin/webpack.js
and see the permissions-rw-r--r--
Previous NPM versions
Following the above steps in npm 6 or npm 7 will not throw the error, and using
ls -l node_modules/webpack/bin/webpack.js
will always show the permissions-rwxr-xr-x
, even on this partial install state.Environment
NOTE: This behavior was initially observed on Ubuntu images running inside Docker. I am reproducing it on a Macbook Pro.
The text was updated successfully, but these errors were encountered: