简体   繁体   中英

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 :

apps/package.json
.drone
.gitignore
readme.md

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)

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

npm init
create a package.json file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM