How to add github dependency in package.json if package.json of second project not in the root of the project

I'd like to add dependency in package.json on github project, but that github project does not have package.json in root of the project. Is it possible to do that?

My package.json:

"dependencies": {
"seg-qa": "myname/seg-qa.git",
"lodash": "^3.5.0",
"bluebird": "^3.5.1",
"moment": "^2.8.4" }

structure of the project myname/seg-qa.git:


But that project "seg-qa": "myname/seg-qa.git" does not have package.json in the root and I'm getting error:

  1. Non-registry package missing package.json: seg-qa@
  2. npm can't find a package.json file in your current directory

Anyone knows how can I add that project as dependency( I google it, did not really find answer for that)

2 answers

  • answered 2018-07-11 04:45 Peng

    npm init
    create a package.json file.

  • answered 2018-07-11 05:30 ronapelbaum

    I also tries it and failed. It seems to be a limitation.

    Hack: you can clone the second repo locally, and state your dep as a local path