Red Hat 7 npm 包安装错误

Red Hat 7 npm 包安装错误

我尝试安装 npm 但系统显示此错误:

[root@myserver etc]# npm install npm@latest -g
npm http GET https://registry.npmjs.org/npm
npm http 200 https://registry.npmjs.org/npm
npm ERR! Error: failed to fetch from registry: npm
npm ERR!     at RegClient.<anonymous> (/usr/lib/node_modules/npm-registry-client/lib/get.js:134:18)
npm ERR!     at cb (/usr/lib/node_modules/npm-registry-client/lib/request.js:27:9)
npm ERR!     at RegClient.<anonymous> (/usr/lib/node_modules/npm-registry-client/lib/request.js:122:16)
npm ERR!     at cb (/usr/lib/node_modules/npm-registry-client/lib/request.js:158:9)
npm ERR!     at RegClient.<anonymous> (/usr/lib/node_modules/npm-registry-client/lib/request.js:303:12)
npm ERR!     at Request.self.callback (/usr/lib/node_modules/request/index.js:148:22)
npm ERR!     at Request.emit (events.js:98:17)
npm ERR!     at Request.<anonymous> (/usr/lib/node_modules/request/index.js:891:14)
npm ERR!     at Request.emit (events.js:117:20)
npm ERR!     at IncomingMessage.<anonymous> (/usr/lib/node_modules/request/index.js:842:12)
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <[email protected]>

npm ERR! System Linux 3.10.0-693.11.1.el7.x86_64
npm ERR! command "node" "/usr/bin/npm" "install" "npm@latest" "-g"
npm ERR! cwd /etc
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.3.6
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /etc/npm-debug.log
npm ERR! not ok code 0

答案1

我认为问题是版本你可以尝试一下

yum install -y gcc-c++ make
curl -sL https://rpm.nodesource.com/setup_8.x | sudo -E bash -

相关内容