Closed
Description
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
If a package contains a node_modules that is symlinked then an npm install will issue the message
npm WARN reify Removing non-directory ....
and delete the node_modules directory.
Expected Behavior
A symlinked node_modules directory should be used as is and not recreated - many people symlink node_modules to a local filesystem so that it does not get synced to cloud storage (like Dropbox).
I suspect that the npm code is just checking if any existing file object named node_modules is a directory and does not also check to see if the non-directory file object is actually a symlinked directory.
Steps To Reproduce
cd /tmp
mkdir symlinked
mkdir z
cd z
npm init -y
ln -s /tmp/symlinked node_modules .
npm install lodash
Environment
- OS: Ubuntu 20.04.1
- Node: 16.7
- npm: 7.21.0