npm安装在访问GIT URL时出错

时间:2015-07-31 11:15:33

标签: node.js git npm

我的package.json具有以下依赖项,

    {
  "name": "AppName",
  "version": "0.0.0",
  "description": "App Description",
  "author": "@author",
  "dependencies": {},
  "devDependencies": {
    "css-flip": "git://github.com/geedmo/css-flip",
    "gulp": "^3.8.10",
    "gulp-angular-htmlify": "^0.4.0",
    "gulp-changed": "^1.1.0",
    "gulp-compass": "^2.0.4",
    "gulp-concat": "^2.4.1",
    "gulp-css-flip": "^0.4.0",
    "gulp-expect-file": "0.0.7",
    "gulp-filter": "^1.0.2",
    "gulp-html-prettify": "0.0.1",
    "gulp-if": "^1.2.5",
    "gulp-ignore": "^1.2.1",
    "gulp-jade": "^0.8.0",
    "gulp-jsvalidate": "^2.0.0",
    "gulp-less": "^1.3.9",
    "gulp-livereload": "^2.1.1",
    "gulp-load-plugins": "^0.10.0",
    "gulp-minify-css": "^0.3.11",
    "gulp-ng-annotate": "^0.4.3",
    "gulp-rename": "^1.2.0",
    "gulp-sass": "^1.3.2",
    "gulp-sourcemaps": "^1.3.0",
    "gulp-sync": "^0.1.4",
    "gulp-uglify": "^1.1.0",
    "gulp-util": "^3.0.1",
    "marked": "^0.3.2",
    "through2": "^0.6.3",
    "yargs": "^3.7.2"
  },
  "scripts": {
    "prestart": "bower install",
    "start": "npm install",
    "poststart": "gulp"
  }
}

当我执行npm install命令时,我收到以下错误,

npm WARN addRemoteGit Error: Command failed: git -c core.longpaths=true config --get remote.origin.url
npm WARN addRemoteGit
npm WARN addRemoteGit     at ChildProcess.exithandler (child_process.js:751:12)
npm WARN addRemoteGit     at ChildProcess.emit (events.js:110:17)
npm WARN addRemoteGit     at maybeClose (child_process.js:1015:16)
npm WARN addRemoteGit     at Socket.<anonymous> (child_process.js:1183:11)
npm WARN addRemoteGit     at Socket.emit (events.js:107:17)
npm WARN addRemoteGit     at Pipe.close (net.js:485:12)
npm WARN addRemoteGit  git://github.com/geedmo/css-flip.git resetting remote C:\Users\drj8cob\AppData\Roaming\npm-cache\_git-remotes\git-github-com-geedmo-css-flip-git-3c35004c because of error: {
 [Error: Command failed: git -c core.longpaths=true config --get remote.origin.url
npm WARN addRemoteGit ]
npm WARN addRemoteGit   killed: false,
npm WARN addRemoteGit   code: 1,
npm WARN addRemoteGit   signal: null,
npm WARN addRemoteGit   cmd: 'git -c core.longpaths=true config --get remote.origin.url' }
npm ERR! git clone --template=C:\Users\drj8cob\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror git://github.com/geedmo/css-flip.git C:\Users\drj8cob\AppData\Roaming\npm-cache\_git-remot
es\git-github-com-geedmo-css-flip-git-3c35004c: Cloning into bare repository 'C:\Users\drj8cob\AppData\Roaming\npm-cache\_git-remotes\git-github-com-geedmo-css-flip-git-3c35004c'...
npm ERR! git clone --template=C:\Users\drj8cob\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror git://github.com/geedmo/css-flip.git C:\Users\drj8cob\AppData\Roaming\npm-cache\_git-remot
es\git-github-com-geedmo-css-flip-git-3c35004c: fatal: Unable to look up github.com (port 9418) (No such host is known. )
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v0.12.7
npm ERR! npm  v2.11.3
npm ERR! code 128

npm ERR! Command failed: git -c core.longpaths=true clone --template=C:\Users\drj8cob\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror git://github.com/geedmo/css-flip.git C:\Users\drj8c
ob\AppData\Roaming\npm-cache\_git-remotes\git-github-com-geedmo-css-flip-git-3c35004c
npm ERR! Cloning into bare repository 'C:\Users\drj8cob\AppData\Roaming\npm-cache\_git-remotes\git-github-com-geedmo-css-flip-git-3c35004c'...
npm ERR! fatal: Unable to look up github.com (port 9418) (No such host is known. )
npm ERR!
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

我是节点模块和git的新手。我是否应该在节点模块中进行与GIT相关的任何配置?

[编辑]:我支持公司代理。应该给出与此相关的任何配置吗?我在users/<username>/.npmrc文件的.npmrc文件中添加了代理详细信息。我的路径变量也有Git / bin位置。

8 个答案:

答案 0 :(得分:41)

此问题在其他thread 中有答案。这个问题发生在我担任公司代理的背后。 @bnguyen82的答案终于帮助了我。

我刚使用以下命令,问题得到了解决。

git config --global url."https://".insteadOf git://

答案 1 :(得分:7)

单独接受的答案对我没有帮助。最后,在我使用npm cache clear清除npm缓存后,它工作正常。

答案 2 :(得分:2)

1.检查您的互联网连接 2.在TERMINAL或CMD中对github.com进行测试 如果一切正常,那就试试吧 使用此格式为您的git url git + https://git@github.com/geedmo/css-flip.git 要么 如果你需要ssh: 混帐+ SSH://git@github.com/visionmedia/express.git

答案 3 :(得分:1)

我遇到了同样的问题,并且能够通过安装git

来解决它
sudo apt-get install git-all

答案 4 :(得分:0)

Git无法链接到指定的网址。你可以尝试git代理模式。  (需要自己的代理服务)

设定:

git config –global http.proxy http://127.0.0.1:1080 
git config –global https.proxy https://127.0.0.1:1080 

取消设置:

git config –global –unset http.proxy 
git config –global –unset https.proxy

答案 5 :(得分:0)

在非交互模式下

要在其中设置项目的文件夹中的Git Bash

expo init AwesomeProject --template blank --workflow managed --name yourappname

答案 6 :(得分:0)

就我而言,git没有安装在我的机器上。

答案 7 :(得分:0)

  1. 只需在您的程序包JSON代码中观察此"css-flip": "git://github.com/geedmo/css-flip"行。
  2. 您的项目取决于存储在另一个项目/存储库中的文件css-flip
  3. 在安装npm时,您的程序包JSON文件将尝试访问和下载另一个仓库的css-flip文件,但可能会阻止该文件。
  4. 在我的情况下, VPN 阻止了其他存储库的依赖文件。因此,我启动了VPN并尝试再次安装npm npm i,它的工作原理就像魔术一样。