24

I am using yarn for my project. My project has a dependency which happened to be a subpackage of larger monorepo maintained by lerna. The subpackage was updated but not published yet and I need that unpublished code. Is there any way to install lerna's subpackage via git url?

Thanks.

3
  • Did you ever find an answer to this? I have the same issue except in my case the subpackage hasn't been updated - I cloned it and updated myself, but can't figure out how to install my version (yarn add git://github.com/MY-USERNAME/REPONAME doesn't work, neither does yarn add git://github.com/MY-USERNAME/REPONAME/packages/PACKAGE-NAME).
    – Chris Boon
    Commented Apr 2, 2018 at 17:12
  • Unfortunately no, I didn’t find solution of that. Commented Apr 2, 2018 at 20:13
  • Possible duplicate of npm install package from github repo subfolder
    – jjbskir
    Commented Mar 12, 2019 at 15:42

2 Answers 2

2

If your questions is "How do I install a sub-package via git?" then that would be a duplicate of this question, which it sounds like you kind of can do, but it does not look fun. But npm on its own does not support installs of git subdirectories.

A better solution would be either to do a release of the package with a npm beta tag and target it directly in your package.json. Or to set up the lerna project locally and run npm link to use it directly.

1

Try GitPkg: https://gitpkg.vercel.app/.

Using sub folders of a repo as yarn/npm dependencies made easy

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.