Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
202 views
in Technique[技术] by (71.8m points)

NPM doesn't install module dependencies

This is my package.json for the module that I'm including in the parent project:

{
  "version": "0.0.1",
  "name": "module-name",
  "dependencies": {
    "express": "3.3.4",
    "grunt": "0.4.1",
    "grunt-contrib-compass": "0.4.0",
    "grunt-contrib-copy": "0.4.1",
    "grunt-contrib-cssmin": "0.4.1",
    "grunt-contrib-jshint": "0.6.3",
    "grunt-contrib-requirejs": "0.4.1",
    "grunt-contrib-uglify": "0.2.2",
    "grunt-contrib-watch": "0.5.1",
    "grunt-express-server": "0.4.1",
    "grunt-karma": "0.4.5",
    "grunt-regex-replace": "0.2.5",
    "request": "2.25.0"
  },
  "scripts": {
    "postinstall": "grunt install"
  }
}

One thing to note is that this module is contained in a private repo and I include it in the parent package.json like: "module-name": "git+ssh://git@myserver:user/module-name.git"

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

It looks like you hit a bug that has existed for quite a while and doesn't have solution yet. There are several open issues for this case in the npm repository:

In the first one people list several workarounds that you may try.

An alternative solution may be (a little hackish) to explicitly list the dependencies as first level dependents. This requires you to maintain the list but practically it has to be done very infrequently.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...