获取 npm 错误!退出错误代码:128

Posted

技术标签:

【中文标题】获取 npm 错误!退出错误代码:128【英文标题】:Getting npm ERR! exited with error code: 128 【发布时间】:2018-06-21 13:01:08 【问题描述】:

我使用以下链接react-native-vector-icons在我的 react 本机项目中尝试了“RNVectorIcons”包。我在终端中使用了 pod install 命令。但我在终端窗口中收到以下错误。

Analyzing dependencies
Fetching podspec for `RNVectorIcons` from `../node_modules/react-native-vector-icons`
Downloading dependencies
Installing RNVectorIcons (4.6.0)
Installing React (0.11.0)
[!] /bin/bash -c 
set -e
npm install --production

npm WARN deprecated connect@2.8.3: connect 2.x series is deprecated
npm WARN deprecated babel-core@5.8.21: Babel 5 is no longer being maintained. Upgrade to Babel 6.
npm WARN deprecated graceful-fs@3.0.11: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated line-numbers@0.2.0: Copy its ~20 LOC directly into your code instead.
npm WARN deprecated tough-cookie@1.2.0: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130
npm WARN deprecated coffee-script@1.6.3: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
npm WARN deprecated formatio@1.1.1: This package is unmaintained. Use @sinonjs/formatio instead
npm WARN deprecated gulp-util@3.0.8: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
npm ERR! Error while executing:
npm ERR! /usr/bin/git ls-remote -h -t git://github.com/facebook/react.git
npm ERR! 
npm ERR! undefined
npm ERR! exited with error code: 128

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/macmini1/.npm/_logs/2018-06-21T12_59_11_182Z-debug.log

我的 package.json 文件如下所示:


  "name": "sample",
  "version": "0.0.1",
  "private": true,
  "scripts": 
    "gulp": "gulp"
  ,
  "dependencies": 
    "eslint": "4.19.1",
    "eslint-config-airbnb": "16.1.0",
    "eslint-config-airbnb-base": "12.1.0",
    "eslint-config-rallycoding": "3.2.0",
    "eslint-import-resolver-webpack": "0.10.0",
    "eslint-plugin-import": "2.12.0",
    "eslint-plugin-jsx-a11y": "6.0.3",
    "eslint-plugin-react": "7.8.2",
    "react": "16.3.1",
    "react-native": "0.55.4",
    "react-native-vector-icons": "4.6.0",
    "react-navigation": "2.3.1"
  ,
  "devDependencies": 
    "babel-jest": "23.0.1",
    "babel-preset-react-native": "4.0.0",
    "jest": "23.1.0",
    "react-test-renderer": "16.3.1"
  ,
  "jest": 
    "preset": "react-native"
  

debug.log 文件是

1609 verbose stack Error: exited with error code: 128
1609 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/pacote/lib/util/finished.js:12:19)
1609 verbose stack     at ChildProcess.emit (events.js:182:13)
1609 verbose stack     at maybeClose (internal/child_process.js:961:16)
1609 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:5)
1610 verbose cwd /Users/macmini1/Library/Caches/CocoaPods/Pods/Release/React/0.11.0-ab1a2
1611 verbose Darwin 17.0.0
1612 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "--production"
1613 verbose node v10.4.1
1614 verbose npm  v6.1.0
1615 error Error while executing:
1615 error /usr/bin/git ls-remote -h -t git://github.com/facebook/react.git
1615 error
1615 error undefined
1615 error exited with error code: 128
1616 verbose exit [ 1, true ]

如何解决这个问题?

【问题讨论】:

【参考方案1】:

能否提供调试日志的内容?您是在添加此软件包后才遇到此问题吗? 你能把你的package.json文件的内容也发一下吗?

也请看一下这个问题/解决方案,看起来确实是您遇到的问题:react-native init AwesomeProject unable to connect to github.com

更新

这可能与访问 github 的方式有关。您可以在重试之前尝试运行以下命令吗?

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

【讨论】:

我用 package.json 和调试日志内容更新了我的问题。 @IKKA 我已经用一个命令更新了答案,您可以尝试更改从 Github 获取 git 存储库的协议。 @sanders,我正在尝试将软件包安装在:github.com/fergarrui/ethereum-graph-debugger/tree/v3.6.0,我运行了 git config --global url."https://".insteadOf git:// 然后 git clone @ 987654323@ 没有错误,但是:npm install,给我以下错误:npm ERR!代码 128 npm 错误! git dep 准备失败,请指导我。

以上是关于获取 npm 错误!退出错误代码:128的主要内容,如果未能解决你的问题,请参考以下文章

命令“npm run build -- --prod”退出并出现代码 1 错误

Github 操作:npm install -> 错误:进程已完成,退出代码为 1

尝试安装项目依赖项时运行 npm i(退出代码 1)时发生错误

“vue-cli-service test:unit” 运行成功;但 npm 退出错误代码 1 ELIFECYCLE

执行命令时代码构建失败并出现错误:npm install。原因:退出状态 127

如何修复节点服务器错误,npm ERR!代码 ELIFECYCLE npm 错误!错误1?