"lerna add" requires package to be present in remote registry (adding unpublished dependencies)
See original GitHub issueHello!
Thank you for your hard work.
However, when using lerna add
command like this: npx lerna add @acme/button --scope @acme/app
it fails with an error: '@acme/button' is not in the npm registry
.
I’m trying to add one local unpublished package to the other one.
In order to work around this I have to add the dependency manually to the package.json
of the @acme/app
package and then run: npm run bootstrap
again, which takes some time to process the dependencies.
I think that lerna should be able to effectively add local unpublished dependencies to local packages, which is the point of using the monorepo in the first place.
Probably, the algorithm should be updated to first look for the specified dependency in the local monorepo’s tree, before trying the remote registry.
What do you think?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:30
- Comments:22 (4 by maintainers)
Top GitHub Comments
Still happens in 2020, any update?
We had a similar issue when adding
local-package
(a new, unpublished package) tosome-other-package
dependencies. When usingnpx lerna add local-package packages/some-other-package
,local-package
also ended up in the rootpackage-lock.json
(wheresome-other-package
is declared a dependency usingfile:packages/some-other-package
) causing the error message above.To work around it it, first run without bootstrapping:
npx lerna add --no-bootstrap local-package some-other-package
. Then convert the dependency to afile:
-dependency usingnpx lerna link convert
. Now you should be able to runnpx lerna bootstrap
without it going to the registry for the unpublished dependency.Adding by relative path (
npx lerna add packages/local-package packages/some-other-package
) seem to not work at all. By reading source it seems like the AddCommand expects aname
from thespec
, which is not returned bynpm-package-arg
for file system local packages.