node.js - npm install 在访问 GIT url 时出错

标签 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>

我是 Node 模块和 git 的新手。我是否必须在 Node 模块中进行与 GIT 相关的任何配置?

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

最佳答案

这个问题在另一个thread有答案。自从我支持公司代理以来,就出现了这个问题。和@bnguyen82的回答终于帮到了我。

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

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

关于node.js - npm install 在访问 GIT url 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31744852/

相关文章:

javascript - 如何在 node.js (express) 中全局设置内容类型

GIT 推送,HTTP 代码 = 502 错误

node.js - "not listed in package.json", 安装 NTVS 时的 node.js

node.js - Node 和/或npm问题

javascript - 访问外部回调函数参数的简单方法是什么?

javascript - 请求返回 unicode 替换字符

javascript - TypeScript 从现有接口(interface)创建新接口(interface)并更改所有属性的类型

node.js - 如何使用 orientjs 针对 OrientDB 执行 Gremlin?

linux - 如何在 linux 中传入读取的 bash 变量并将其作为消息发送到 git commit 中?

ruby - system ("git push 2>&1") 工作正常,但 %x(git push 2>&1) 挂起。为什么?