[英]Private github repo as dependency is extraneous on npm install
This is my first time using a private repo as a dependency in another project. 这是我第一次使用私有仓库作为另一个项目的依赖项。 I think I am doing it right, but the dependency is not available in the new project after install and is not in node_modules. 我认为我做得对,但安装后新项目中的依赖项不可用,并且不在node_modules中。
Following this post I can see that I am including it in the package.json correctly like: 在这篇文章之后,我可以看到我正确地将它包含在package.json中:
"myPackage": "git+https://github.com/myusername/mygitrepository.git"
When I run npm install
on this package, I see this that it does not have an error, but after this dependency in the list, it is shown with extraneous(git+https://github.com/myusername/mygitrepository.git)
. 当我在这个包上运行npm install
时,我看到它没有错误,但是在列表中的这个依赖项之后,它显示为extraneous(git+https://github.com/myusername/mygitrepository.git)
。
Even though there is the extraneous issue, there is no error, and the dependency is not available or listed in node_modules. 即使存在无关紧要的问题,也没有错误,并且依赖项不可用或在node_modules中列出。
Update: repo_A package.json 更新: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"
}
}
Update: repo_B package.json 更新: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"
}
}
Update for latest steps Here are the steps I am following now to test each possible solution, followed by the output: 更新最新步骤以下是我现在要遵循的步骤,以测试每个可能的解决方案,然后输出:
rm -rf node_modules
npm cache clean
npm install
Output 产量
├─┬ 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)
.......
If you specify https then that will be looking for a login user and password I believe, which I don't think it can load automatically. 如果您指定https,则会查找我认为的登录用户和密码,我不认为它可以自动加载。 I would list it simply as "user/repo" and make sure that machine has an ssh key on it that is in github like the setup described in help such as https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/#platform-linux and that things are setup so that pulling down that repo does not require user interaction. 我会将它简单地列为“user / repo”并确保该机器上有一个ssh密钥,它位于github中,就像帮助中描述的设置一样,例如https://help.github.com/articles/generating-a- new-ssh-key-and-getting-it-to-ssh-agent / #planet-linux并且设置的东西是这样的,以便拉下该repo不需要用户交互。
EDIT: After testing, I think the issue is that your name
in the package.json does not match how you have listed it in your main project's dependencies. 编辑:经过测试,我认为问题是你在package.json中的name
与你在主项目的依赖项中列出的name
不符。 In my test, this resulted in the modules being installed but I got the extraneous message. 在我的测试中,这导致了模块的安装,但我收到了无关的消息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.