-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] npm ci fails to install nested local path dependencies #529
Comments
Any ideas why this is happening? This means I'm unable to use |
Maybe same as #496 |
I am also faced with this issue with
In my case all of the files listed in the errors actually exist. Maybe they can't be updated because the lock(?). |
I can confirm the issue. Installing using Deleting the package-lock.json files is not a workaround as it will only work until the files are created again on the next run. I found that when I use local dependency references that point to a tgz-file instead of the project folder, then npm is able to correctly resolve the dependency tree and the issue no longer appears.
The difference appears to be that when referencing local packages by folder, npm seems to just copy the entire package folder into the node-modules folder of the referencing package including the node-modules folder of the referenced package instead of flattening the references. Why this behaves like this I don't know. I have also not used I'm running on node v10.18.0 & npm 6.13.6 (also tried npm 6.13.4) EDIT: I tried with |
The problem here is that In a system where the dependency graph goes packageA -> packageB -> packageC, npm creates links like this:
If you were to In order to fix this, npm is going to need to compute symlink paths in the local dependencies of local dependencies based on the relative filesystem locations of the local packages. |
The problem appears for me if the node_modules directory exists before running My package.json looks something like this: ...
"dependencies": {
"submodule1": "file:submodule1/es5/",
"submodule2": "file:submodule2/es5/"
},
... My directory structure looks like this:
My build script looks something like this: rm -rf ./node_modules #this line seems to help
( cd ./submodule1 && bash ./build.sh )
( cd ./submodule2 && bash ./build.sh )
npm ci Tried this several times now in two projects. If i will see different results in the future i will update this comment. |
I have a similar issue, but not quite the same. I'm working in a monorepo where the setup is like this:
(I'm aiming to share assets and other custom components between the Applications as well as within the packages in some cases) In this particular setup I have the same dependency in both ApplicationA and in PackageA. They both reference PackageB that is, in this case a small library with assets (custom icons) that are referenced in both ApplicationA and PackageA. I install with Then I do
Using npm pack and referencing the tarballs solves the issue, but that forces me to bump version number and run npm pack for each iteration. And it makes it harder to develop more complex packages. When installing a local package using the folder with no tarball create-react-app will hot reload the changes if I have a watch/compile script in PackageA that compiles to /dist on changes. |
So is there any workaround? We're running into CI build errors because we get this error everyone once in a while. Rerunning the build fixes the issue most of the time. |
Given the length of time this issue has been open, is it safe to assume this is not going to be fixed? I just came across this problem at the weekend. |
I recently converted my project to use Yarn's workspaces as a way of working round this issue. |
For anyone who goes digging like I did: fixed in npm v7: #1414 |
npm If your bug is preproducible on If your issue was a feature request, please consider opening a new RRFC or RFC. If your issue was a question or other idea that was not CLI-specific, consider opening a discussion on our feedback repo Closing: This is an automated message. |
… web-apps" This reverts commit 5012e4e. because error with npm ci (-v 9) on package-lock.json(-v 6) file with local dependencies npm/cli#5125 npm/cli#529
What / Why
When at least two levels of dependencies are present eg packageA -> packageB -> packageC, and are referenced by local path npm fails to find the reference to packageC and errors with eth following error:
When
For local path dependencies eg
file:../packageA
which are more than one level deep. Ie a local package references a local package which references a local package.Where
How
Current Behavior
Fails to install nested dependency.
Steps to Reproduce
Reproducible in the following repo:
https://github.com/yahgwai/npm-ci-local-path
Run the following commands to reproduce:
Expected Behavior
Should not error during npm ci
Who
References
The text was updated successfully, but these errors were encountered: