【发布时间】:2016-07-04 20:31:34
【问题描述】:
我有一个 git 存储库,并希望将此存储库用作其他项目的 package.json 文件中的依赖项,以便在我们运行 npm 命令时可以下载它。 谁能帮帮我?
【问题讨论】:
标签: angularjs git reactjs repository package.json
我有一个 git 存储库,并希望将此存储库用作其他项目的 package.json 文件中的依赖项,以便在我们运行 npm 命令时可以下载它。 谁能帮帮我?
【问题讨论】:
标签: angularjs git reactjs repository package.json
试试这个。
"dependencies": {
"<repo>": "<user>/<repo>#<branch>",
}
例子:
"dependencies": {
"botkit": "jonchurch/botkit#master",
}
【讨论】:
来自NPM docs:
Git URL 作为依赖项
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
【讨论】:
在您的package.json 中尝试以下格式:
"dependencies" : {
"projectName" : "git://github.com/user/project.git"
}
【讨论】: