npm install for package with local dependency fails

help-wanted
cli
triaged
priority:medium

(Baptiste Marchand) #21

I’m using 6.6.0-next.1 and I still can’t install local dependencies.
Here is a minimal repo showing the problem: https://github.com/baptistemarchand/npm-local-path-bug-repro
I have two packages A and B.
A depends on B, using a local path (file:../).
B depends on left-pad (sorry :blush: ).

.
β”œβ”€β”€ a
β”‚   β”œβ”€β”€ package-lock.json
β”‚   └── package.json
└── b
    └── package.json

When I run npm install in package A it succeeds (there are no errors), the symlink to package B is created in node_modules (as expected) but the dependencies of B are not installed. The tree now looks like this :

..
β”œβ”€β”€ a
β”‚   β”œβ”€β”€ node_modules
β”‚   β”‚   └── b -> ../../b
β”‚   β”œβ”€β”€ package-lock.json
β”‚   └── package.json
└── b
    └── package.json

If I use npm ci instead of npm install it works as expected, producing the following tree:

.
β”œβ”€β”€ a
β”‚   β”œβ”€β”€ node_modules
β”‚   β”‚   └── b -> ../../b
β”‚   β”œβ”€β”€ package-lock.json
β”‚   └── package.json
└── b
    β”œβ”€β”€ node_modules
    β”‚   └── left-pad
    β”‚       β”œβ”€β”€ ....
    └── package.json

It also installs correctly if I remove the package-lock.json in package A.

Am I right to think that this is caused by the same bug discussed above?

Thank you for your help.


(Kellen Green) #22

Any news on a fix for this? I too can reproduce this.


(Andrew Metcalf) #24

I am still hitting this error on Travis builds when using file: dependencies, and always hit it locally on subsequent npm installs as well. Looking around it seems like this has been an issue for over a year – is this slated to be fixed?