Missing transitive dependencies when installing npm from github

Hi

i have a repository of npm library which being used by other repos.
i want to be able to test this library properly before releasing a new release from specific branch.

i saw it is possible to install npm pacakge from github repository so i did the following:

  • updated the library-repo to include prepare script like this:
    “preapre”: “npm run build”
  • updated one of the repository that using this library (repo1) on package.json with the following:
    @org/library-repo”: “github:org/library-repo#branch”
    (instead of “@org/library-repo”: “0.0.1” )

when i do npm install on repo1 the package indeed installed but the library dependencies installed on the node_modules directory of the library , not on the local node_modules folder.
so when running the application, i get alot of ‘cannot find module’ errors as i require some of the transitive dependencies and do not directly exist.
copy the node_modules/@org/my-library-repo/node_modules into local node_modules solves this issue but it doesnt seems ideal.

what am i missing?
thanks!

This seems to be an issue with npm and unfortunately I couldn’t find a solution for it yet

One thing you could do is to npm link your library-repo package everywhere so you only have to install the dependencies in there once

E.g.

  1. git clone <library-repo url>
  2. cd library-repo
  3. npm link
  4. npm install
  5. cd ../other-repo-that-needs-library-repo
  6. npm link @org/library-repo