npm使用子模块安装forked git [英] npm install forked git with submodule
问题描述
我正在尝试通过 npm install
从npm安装 node-gitteh
作为依赖项的package.json
。不幸的是,这个npm软件包在节点0.6.x中被破坏了,但没有问题,因为有一个分叉的仓库解决了这些问题(https://github.com/hughsk/node-gitteh.git)。
I'm trying to get npm to install node-gitteh
as a dependency via npm install
which reads from package.json
. Unfortunately this npm package is broken in node 0.6.x, but no problem as there's a forked repo that fixes the issues (https://github.com/hughsk/node-gitteh.git).
现在问题是这个分叉的repo有一个子模块,所以如果我尝试从 package.json
中的github下载tar:
Now the issue is that this forked repo has a submodule, so if I try to download the tar from github in the package.json
:
, "dependencies" : {
"gitteh" : "https://github.com/hughsk/node-gitteh/tarball/master"
}
我收到的错误相当于submodule文件夹没有发现。如果我手动克隆相同的repo并从 node-gitteh
文件夹执行递归子模块更新和 npm install
,它工作正常,但我无法弄清楚如何让npm这样做。
I get an error that equates to "submodule folder not found". If I clone the same repo manually and do a recursive submodule update and an npm install
from the node-gitteh
folder, it works fine, but I can't figure out how to get npm to do this.
推荐答案
我有同样的问题,到目前为止,只依赖于将我的模块克隆到node_modules并手动执行子模块更新。让npm自动处理这个会很好。
I've had the same problem and so far have just relied on cloning my module into node_modules and doing a submodule update manually. It would be nice to have npm handle this automatically.
在package.json中有一个脚本字段(参见 npm docs )
所以可以做
In package.json there's a scripts field (see npm docs) So could do
"scripts":{"preinstall": "git submodule update -i -r"}
参见 https://github.com/isaacs/octave-test 就是一个例子。
这篇关于npm使用子模块安装forked git的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!