最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - npm install forked git with submodule - Stack Overflow

programmeradmin5浏览0评论

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 (.git).

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" : ";
}

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.

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./hughsk/node-gitteh.git).

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./hughsk/node-gitteh/tarball/master"
}

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.

Share Improve this question edited Apr 13, 2022 at 11:56 Dharman 33.4k27 gold badges101 silver badges147 bronze badges asked Mar 3, 2012 at 5:15 user578895user578895
Add a ment  | 

2 Answers 2

Reset to default 6

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.

In package.json there's a scripts field (see npm docs) So could do

"scripts":{"preinstall": "git submodule update -i -r"}

See https://github./isaacs/octave-test for an example of this.

According to the docs, you need to supply the git url in a special format. Also, it needs to point to git repo (same address you would use for git clone), not the tarball provided by github.

In your case (git over https), it would be:

, "dependencies" : {
  "gitteh" : "git+https://github./hughsk/node-gitteh"
}

Using this, npm will default to the master branch.

发布评论

评论列表(0)

  1. 暂无评论