Repository navigation
Closed
nodejs/node
#41925Labels
Bugthing that needs fixingthing that needs fixingPriority 0will get attention right awaywill get attention right awayRelease 7.xwork is associated with a specific npm 7 releasework is associated with a specific npm 7 release
Milestone
Description
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
In a workspaces based environment, for example:
.
+-- package.json
`-- packages
+-- a
| `-- package.json
`-- b
`-- package.json
Running npm install b --workspace a will no longer install the locally linked package correctly. Instead, it'll use the version hosted on npm, or throw a 404 if you use a custom (unique) package name.
Expected Behavior
In <7.20.x, NPM would resolve the local package, and correctly alter package.json and package-lock.json.
Steps To Reproduce
With node v16.6.1 and npm 7.20.3 installed:
- Make a new directory
mkdir ./npm-install-debug
- Add a package.json
cd ./npm-install-debug
npm init -y
- Setup 2 workspace packages
npm init -w ./packages/a
npm init -w ./packages/b
(I used @rijk/a and @rijk/b as names, to avoid confusion with the existing packages a and b.)
- Run
npm installin the root, to give it a chance to npm link all the packages (not sure if needed)
npm install
- Try installing
@rijk/bas a dependency of@rijk/a
npm install @rijk/b -w @rijk/a
- See error...
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@rijk%2fb - Not found
npm ERR! 404
npm ERR! 404 '@rijk/b@*' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/rijkvanzanten/.npm/_logs/2021-08-10T20_07_25_648Z-debug.log
If you install 7.20.2 or below (npm i -g npm@7.20.2), the above flow still works as expected.
Environment
- OS: macOS 11.4, also seen in GitHub Actions
- Node: v16.6.1
- npm: 7.20.3 and up
Reacted by Nicola Krumschmidt, Alvis Tang, Simon Tretter, Rijk van Zanten, Tobias, Matthias Ringwald, Sebastian Ulbel, Denny, Arno Schutijzer, Pascal Jufer and 34 more
Reacted by Alvis Tang, orun and darwin403
Reacted by Ryan Ghods, darwin403 and Manuel Fernández Molina
Metadata
Metadata
Assignees
Labels
Bugthing that needs fixingthing that needs fixingPriority 0will get attention right awaywill get attention right awayRelease 7.xwork is associated with a specific npm 7 releasework is associated with a specific npm 7 release
Activity
gribnoysup commentedon Aug 11, 2021
Running into the same issue without even trying to install specific packages inside the workspaces, just running
npm installfrom the project root where some workspaces are not yet published / missing from the registry. If that's any help for triaging, here is a very verbose install log of a failed installParadoxInfinite commentedon Aug 14, 2021
I could reproduce the result by using the steps in the issue.
After a bit of shallow debugging, I found that the error
E404is found even in v7.20.2, it is not thrown however. In the latest build v7.20.6, it is. So, not sure if this is intended or a bug.Now, I did a bit more digging around and found there are a couple of interesting keys which differ between v7.20.6 and v7.20.2
In the parent node:
I couldn't get any further than this, so if someone who knows the https://github.com/npm/arborist codebase better could help or point me out on where to look, that'd be great!
Finally, by the looks of it, this issue would be more relevant to https://github.com/npm/arborist, you could try raising an issue there!
willnode commentedon Aug 15, 2021
I had a problem with Gatsby running with Workspaces.
Then adding workspaces in package.json
Before dedupe
After dedupe
Despite
This broke my gatsby builds.
Unfortunately downgrading to 7.20.2 didn't work for me :( could be a separate issue.
My node is v14.17.3
simllll commentedon Aug 30, 2021
Anything we can do to get this fixed? Super annoying bug for us, I need to downgrade npm every few days due to this issue.
rijkvanzanten commentedon Aug 30, 2021
We temporarily updated our CI/CD pipeline to a locked outdated version of NPM to mitigate this:
https://github.com/directus/directus/blob/607e32ea36c115a9d6cf820a26475ebbf9e6e9ed/.github/workflows/release.yml#L36-L42
For what it's worth, OSS - Sprint 36 says it's due September 07, so lets hope for the best 🤞🏻
simllll commentedon Oct 5, 2021
Is there any status update to this issue? Will it be fixed? Is it not reproducable on your side? Or will this be the new intended behaviour? Thanks
all are actually in the same monorepo:
npm WARN
npm WARN Could not resolve dependency:
npm WARN @hokify/shared-components@"^1.2.9" from @hokify/pwa-core@1.2.10
npm WARN packages/pwa-core
npm WARN @hokify/pwa-core@1.2.6
npm WARN node_modules/@hokify/pwa-core
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@hokify%2fuser-app - Not found
npm ERR! 404
npm ERR! 404 '@hokify/user-app@^1.2.10' is not in this registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
rijkvanzanten commentedon Oct 12, 2021
I'm wondering if the regression that caused this might be related to #3881
33 remaining items
manolakis commentedon Feb 22, 2023
ok, I did a try in modern versions and seems to be fixed in version 9.4.2+
DesignByOnyx commentedon Mar 8, 2023
I wanted to report that
npm@8.19.4(released 6 days ago, March 1, 2023) fixes this issue. I was previously on8.19.3and the issue went away after upgrading. A couple notes:"<package_name>": "*"where the version number is"*". If you do this, npm will recognize it as a local dependency. I tested this prior to upgrading.SergkeiM commentedon Jul 4, 2023
node: v18.14.2
npm: 9.5.0
Doesn't work...
szszoke commentedon Jul 14, 2023
I am having this issue with npm 9.8.0 as well.
davidvpe commentedon Jul 24, 2023
same here 9.5.1
LoganArnett commentedon Oct 4, 2023
This is happening again on v10.2.0
lukekarrys commentedon Oct 4, 2023
@LoganArnett can you open a new issue with your reproduction for this?
gavenkoa commentedon Oct 11, 2023
node/16.14.0 with
has a problem. Upgrade to node/16.20.2 with
fixes the issue.
DesignByOnyx commentedon Oct 11, 2023
FWIW - Node 16.x has reached the end of it's life and should not be used any more. Also npm can be upgraded independently of node by doing
npm i -g npm@latest.philly-vanilly commentedon Nov 30, 2023
I am on latest node lts v20.10.0, 10.2.3 and this is still an issue. I suspect it is one with npm, not node though
StanleyDharan commentedon Feb 6, 2024
No longer an issue on
node v20.11.0npm v10.2.4Anonyfox commentedon Jul 19, 2024
actually still a problem with node v22.4.1 and npm v10.8.2
ericljiang commentedon Mar 10, 2025
Had this issue on 10.9.0, fixed after upgrading to 10.9.2
try and fix failing build
try and fix failing build