'NPM 8 workspaces - Install one package as the dependency for another package in monorepo
Say I have the following structure
packages
- @my-scope/packageA
- @my-scope/packageB
- @my-scope/packageC
Let's say I want to install packageA as a dependency of packageB. With NPM 8 workspaces I would think this ought to do it:
npm install @my-scope/packageA --workspace=@my-scope/packageB
Instead I get this:
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@my-scope%2fpackageA - Not found
npm ERR! 404
npm ERR! 404 '@my-scope/packageA@*' is not in this 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.
Clearly it is trying to get it from the registry (and no, I haven't published yet, not ready) but I want it to recognize that this dependency is in my project as a workspace. Anyone know why this might be happening? I haven't found many good resources explaining how to install dependencies from inside your monorepo (I don't even know what those are called...).
Solution 1:[1]
The problem you are facing has been reported as a bug: https://github.com/npm/cli/issues/3637
It has been marked as fixed.
Please try to install the latest version of npm
(8.8.0 as of this writing) and see if your problem has been resolved.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | ob-ivan |