I am having a git repository and want to use this repository as a dependency in package.json file of some other project so that it can be downloaded as we run npm command. can anyone help me out?
Asked
Active
Viewed 5,169 times
3 Answers
6
Try this.
"dependencies": {
"<repo>": "<user>/<repo>#<branch>",
}
Example:
"dependencies": {
"botkit": "jonchurch/botkit#master",
}

Rafael Pizao
- 742
- 8
- 21
1
From the NPM docs:
Git URLs as Dependencies
git://github.com/user/project.git#commit-ish
git+ssh://user@hostname:project.git#commit-ish
git+ssh://user@hostname/project.git#commit-ish
git+http://user@hostname/project/blah.git#commit-ish
git+https://user@hostname/project/blah.git#commit-ish

Bjørn Sørensen
- 901
- 1
- 6
- 14
-
1can you please elaborate little more? – Vivek Gupta Mar 18 '16 at 08:44
0
Try below format in your package.json
:
"dependencies" : {
"projectName" : "git://github.com/user/project.git"
}

Deepak Biswal
- 4,280
- 2
- 20
- 37
-
Could not install /tmp/npm-14485-f3914b67/git-cache-5670ae183f1b/efb22ee81642ce5f041c7e9f0e793c5618f569cf this error is coming – Vivek Gupta Mar 18 '16 at 08:39