【发布时间】:2019-05-06 19:37:21
【问题描述】:
我们可以像这样在 Github 上引用 NPM deps:
"dependencies":{
"foo":"github.com/org/root#commit"
}
但我有一个 Git 存储库,其中包含多个 NPM 库,如下所示:
root/
nodejs/
foo/
package.json
bar/
package.json
有没有办法直接从这个 Github repo 安装 foo?像这样?
"dependencies":{
"foo":"github.com/org/root/nodejs/foo#commit"
}
我尝试使用该网址进行安装,但没有成功,我收到此错误:
npm ERR! code ENOPACKAGEJSON npm ERR! package.json Non-registry package missing package.json: https://raw.githubusercontent.com/org/root/master/nodejs/foo/package.json. npm ERR! package.json npm can't find a package.json file in your current directory. npm ERR! A complete log of this run can be found in: npm ERR! /home/oleg/.npm/_logs/2018-12-05T09_15_28_666Z-debug.log
我也尝试过像这样使用 raw.githubusercontent.com:
"dependencies":{
"foo":"raw.githubusercontent.com/org/root/nodejs/foo#commit"
}
我也遇到了同样的错误。这肯定有可能吗?
【问题讨论】:
-
NPM 社区类似问题:npm.community/t/…
标签: git github npm npm-install