【发布时间】:2017-08-22 05:28:06
【问题描述】:
这是我第一次在另一个项目中使用私有 repo 作为依赖项。我想我做得对,但是安装后新项目中没有依赖项,并且不在node_modules中。
在this post 之后,我可以看到我正确地将它包含在 package.json 中,例如:
"myPackage": "git+https://github.com/myusername/mygitrepository.git"
当我在这个包上运行npm install时,我看到它没有错误,但是在列表中的这个依赖之后,它显示为extraneous(git+https://github.com/myusername/mygitrepository.git)。
即使存在无关问题,也没有错误,并且依赖项不可用或在 node_modules 中列出。
更新:repo_A package.json
{
"name": "project-name",
"version": "1.0.0",
"description": "Backend utility functions",
"scripts": {
"test": "mocha"
},
"repository": {
"type": "git",
"url": "git+https://github.com/user/repo.git"
},
"author": "me",
"license": "ISC",
"bugs": {
"url": "https://github.com/user/repo/issues"
},
"homepage": "https://github.com/user/repo#readme",
"dependencies": {
"lodash": "^4.17.4",
"mongodb": "^2.2.25",
"redis": "^2.7.1",
"winston": "^2.3.1"
}
}
更新:repo_B package.json
{
"name": "main-project-name",
"version": "1.0.0",
"description": "",
"repository": {
"type": "git",
"url": "git+https://github.com/user/repo.git"
},
"author": "someone else",
"homepage": "https://github.com/user/repo.git",
"dependencies": {
"async": "2.1.4",
"chai": "^3.5.0",
"langs": "1.1.0",
"lodash": "4.13.1",
"node-stopwatch": "0.0.1",
"request": "2.74.0",
"winston-loggly": "^1.3.1",
"utils": "user/repo_A.git#master"
},
"scripts": {
"test": "mocha"
}
}
更新最新步骤 以下是我现在要测试每个可能的解决方案的步骤,然后是输出:
rm -rf node_modules
npm cache clean
npm install
输出
├─┬ async@2.1.4
│ └── lodash@4.17.4
├─┬ chai@3.5.0
│ ├── assertion-error@1.0.2
│ ├─┬ deep-eql@0.1.3
│ │ └── type-detect@0.1.1
│ └── type-detect@1.0.0
├── util@1.0.0 extraneous (git+ssh://git@github.com/user/repo_A.git#commit-ish)
.......
【问题讨论】:
标签: node.js git npm-install package.json