You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.
When node_modules is a symlink that points to a directory outside of the current directory, a second npm install will produce a different structure of the dependencies in the node_modules directory.
For example, the first npm install async will produce the following structure of node_modules:
async
lodash
After running npm install, it will change to this:
async
async/node_modules/lodash
One effect of this is that the npm-shrinkwrap.json file is updated to reflect the changed directory structure, which can be a problem if it's checked in to version control.
Note that the symlink must point to somewhere outside of the current directory. If it points to somewhere in the same directory the bug cannot be reproduced.
How can the CLI team reproduce the problem?
$ mkdir -p project node_modules
$ cd project
$ ln -s ../node_modules node_modules
$ npm init --force
$ npm i async
$ ls node_modules/
async lodash
$ npm i
$ ls node_modules/
async
This is where things go wrong. When npm is trying to find lodash it first inspects async's children. But doesn't find it, since lodash is a child of top package at the moment. And this line prevents it to look among top package's children.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I'm opening this issue because:
What's going wrong?
When node_modules is a symlink that points to a directory outside of the current directory, a second
npm install
will produce a different structure of the dependencies in the node_modules directory.For example, the first
npm install async
will produce the following structure of node_modules:After running
npm install
, it will change to this:One effect of this is that the npm-shrinkwrap.json file is updated to reflect the changed directory structure, which can be a problem if it's checked in to version control.
Note that the symlink must point to somewhere outside of the current directory. If it points to somewhere in the same directory the bug cannot be reproduced.
How can the CLI team reproduce the problem?
supporting information:
npm -v
prints:5.5.1
node -v
prints:v8.9.1
npm config get registry
prints:https://registry.npmjs.org/
Linux (Ubuntu 16.04)
The text was updated successfully, but these errors were encountered: