NPM安装返回错误(npm install returning error)

2019-09-26 04:45发布

我试图安装从GitHub的项目,并按照安装说明操作。 当我运行NPM在项目目录中安装它返回下面的错误的结果:

root@server:/var/www/nomp# npm install
npm WARN colors@0.6.2 package.json: bugs['name'] should probably be bugs['url']
npm http GET https://registry.npmjs.org/body-parser
npm http GET https://registry.npmjs.org/request
npm http GET https://registry.npmjs.org/bignum

npm ERR! Error: failed to fetch from registry: request
npm ERR!     at /usr/share/npm/lib/utils/npm-registry-client/get.js:139:12
npm ERR!     at cb (/usr/share/npm/lib/utils/npm-registry-client/request.js:31:9)
npm ERR!     at Request._callback (/usr/share/npm/lib/utils/npm-registry-client/request.js:136:18)
npm ERR!     at Request.callback (/usr/lib/nodejs/request/main.js:119:22)
npm ERR!     at Request.<anonymous> (/usr/lib/nodejs/request/main.js:212:58)
npm ERR!     at Request.emit (events.js:88:20)
npm ERR!     at ClientRequest.<anonymous> (/usr/lib/nodejs/request/main.js:412:12)
npm ERR!     at ClientRequest.emit (events.js:67:17)
npm ERR!     at HTTPParser.onIncoming (http.js:1261:11)
npm ERR!     at HTTPParser.onHeadersComplete (http.js:102:31)
npm ERR! You may report this log at:
npm ERR!     <http://bugs.debian.org/npm>
npm ERR! or use
npm ERR!     reportbug --attach /var/www/nomp/npm-debug.log npm
npm ERR! 
npm ERR! System Linux 3.8.0-29-generic
npm ERR! command "node" "/usr/bin/npm" "install"
npm ERR! cwd /var/www/nomp
npm ERR! node -v v0.6.12
npm ERR! npm -v 1.1.4
npm ERR! message failed to fetch from registry: request
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /var/www/nomp/npm-debug.log
npm not ok

有谁知道这个问题? 我刚安装和的NodeJS NPM所以我不知道为什么会发生这种事。

编辑(设置注册表后跑了):

npm WARN colors@0.6.2 package.json: bugs['name'] should probably be bugs['url']
npm http GET https://registry.npmjs.org/body-parser
npm http GET https://registry.npmjs.org/request
npm http GET https://registry.npmjs.org/bignum

npm ERR! Error: failed to fetch from registry: request
npm ERR!     at /usr/share/npm/lib/utils/npm-registry-client/get.js:139:12
npm ERR!     at cb (/usr/share/npm/lib/utils/npm-registry-client/request.js:31:9)
npm ERR!     at Request._callback (/usr/share/npm/lib/utils/npm-registry-client/request.js:136:18)
npm ERR!     at Request.callback (/usr/lib/nodejs/request/main.js:119:22)
npm ERR!     at Request.<anonymous> (/usr/lib/nodejs/request/main.js:212:58)
npm ERR!     at Request.emit (events.js:88:20)
npm ERR!     at ClientRequest.<anonymous> (/usr/lib/nodejs/request/main.js:412:12)
npm ERR!     at ClientRequest.emit (events.js:67:17)
npm ERR!     at HTTPParser.onIncoming (http.js:1261:11)
npm ERR!     at HTTPParser.onHeadersComplete (http.js:102:31)
npm ERR! You may report this log at:
npm ERR!     <http://bugs.debian.org/npm>
npm ERR! or use
npm ERR!     reportbug --attach /var/www/nomp/npm-debug.log npm
npm ERR! 
npm ERR! System Linux 3.8.0-29-generic
npm ERR! command "node" "/usr/bin/npm" "install"
npm ERR! cwd /var/www/nomp
npm ERR! node -v v0.6.12
npm ERR! npm -v 1.1.4
npm ERR! message failed to fetch from registry: request
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /var/www/nomp/npm-debug.log
npm not ok
root@pool:/var/www/nomp# vi npm-debug.log
root@pool:/var/www/nomp# vi npm-debug.log
root@pool:/var/www/nomp# npm install
npm WARN colors@0.6.2 package.json: bugs['name'] should probably be bugs['url']
npm http GET https://registry.npmjs.org/body-parser
npm http GET https://registry.npmjs.org/request
npm http GET https://registry.npmjs.org/bignum

npm ERR! Error: failed to fetch from registry: request
npm ERR!     at /usr/share/npm/lib/utils/npm-registry-client/get.js:139:12
npm ERR!     at cb (/usr/share/npm/lib/utils/npm-registry-client/request.js:31:9)
npm ERR!     at Request._callback (/usr/share/npm/lib/utils/npm-registry-client/request.js:136:18)
npm ERR!     at Request.callback (/usr/lib/nodejs/request/main.js:119:22)
npm ERR!     at Request.<anonymous> (/usr/lib/nodejs/request/main.js:212:58)
npm ERR!     at Request.emit (events.js:88:20)
npm ERR!     at ClientRequest.<anonymous> (/usr/lib/nodejs/request/main.js:412:12)
npm ERR!     at ClientRequest.emit (events.js:67:17)
npm ERR!     at HTTPParser.onIncoming (http.js:1261:11)
npm ERR!     at HTTPParser.onHeadersComplete (http.js:102:31)
npm ERR! You may report this log at:
npm ERR!     <http://bugs.debian.org/npm>
npm ERR! or use
npm ERR!     reportbug --attach /var/www/nomp/npm-debug.log npm
npm ERR! 
npm ERR! System Linux 3.8.0-29-generic
npm ERR! command "node" "/usr/bin/npm" "install"
npm ERR! cwd /var/www/nomp
npm ERR! node -v v0.6.12
npm ERR! npm -v 1.1.4
npm ERR! message failed to fetch from registry: request
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /var/www/nomp/npm-debug.log
npm not ok
root@pool:/var/www/nomp# vi npm-debug.log
root@pool:/var/www/nomp# vi npm-debug.log
root@pool:/var/www/nomp# npm config set registry http://registry.npmjs.org/
root@pool:/var/www/nomp# npm install
npm WARN colors@0.6.2 package.json: bugs['name'] should probably be bugs['url']
npm http GET http://registry.npmjs.org/body-parser
npm http GET http://registry.npmjs.org/request
npm http GET http://registry.npmjs.org/bignum
npm http 200 http://registry.npmjs.org/request
npm http GET http://registry.npmjs.org/request/-/request-2.34.0.tgz
npm http 200 http://registry.npmjs.org/request/-/request-2.34.0.tgz
npm http 200 http://registry.npmjs.org/body-parser
npm http GET http://registry.npmjs.org/body-parser/-/body-parser-1.0.2.tgz
npm http 200 http://registry.npmjs.org/bignum
npm http GET http://registry.npmjs.org/bignum/-/bignum-0.6.2.tgz
npm http 200 http://registry.npmjs.org/body-parser/-/body-parser-1.0.2.tgz
npm http 200 http://registry.npmjs.org/bignum/-/bignum-0.6.2.tgz

npm ERR! Unsupported
npm ERR! Not compatible with your version of node/npm: request@2.34.0
npm ERR! Required: ["node >= 0.8.0"]
npm ERR! Actual:   {"npm":"1.1.4","node":"0.6.12"}
npm ERR! 
npm ERR! System Linux 3.8.0-29-generic
npm ERR! command "node" "/usr/bin/npm" "install"
npm ERR! cwd /var/www/nomp
npm ERR! node -v v0.6.12
npm ERR! npm -v 1.1.4
npm ERR! code ENOTSUP
npm ERR! message Unsupported
npm ERR! errno {}
npm http GET http://registry.npmjs.org/type-is
npm http GET http://registry.npmjs.org/raw-body
npm http GET http://registry.npmjs.org/qs

> bignum@0.6.2 install /var/www/nomp/node_modules/bignum
> node-gyp configure build

sh: 1: node-gyp: not found
npm ERR! error installing bignum@0.6.2
npm http 200 http://registry.npmjs.org/qs
npm http 200 http://registry.npmjs.org/raw-body
npm ERR! error installing body-parser@1.0.2
npm http GET http://registry.npmjs.org/qs/-/qs-0.6.6.tgz
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /var/www/nomp/npm-debug.log
npm not ok

Answer 1:

我也打成了这个错误。 这可能是由于我的网络。

我摸出为:

npm --strict-ssl false install <pkg>

此选项设置的NodeJS的CA作为可选的验证。 我认为这是作为Sandile的回答同样的效果。



Answer 2:

我觉得就是这样的一个问题已经回答了在一定程度上这里: NPM安装错误 。

但是,为了节省时间,尽量npm config set registry http://registry.npmjs.org/



Answer 3:

我是有这个同样的问题与相同版本的节点和防范机制。

npm ERR! node -v v0.6.12
npm ERR! npm -v 1.1.4

这些是您使用apt-get的Ubuntu的获得的版本。

要解决这个问题,我删除了旧版本:

sudo apt-get remove nodejs

这将删除节点和故宫。 然后安装了最新的:

mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=/usr/local
make
sudo make install
sudo chmod -R a+rx /usr/local/lib/node_modules

当你用它做,你可以删除安装目录。 我得到了我这个基础上从剧本: https://gist.github.com/isaacs/579814链接到来自: http://www.joyent.com/blog/installing-node-and-npm/这篇文章是有点过时了。 例如,NPM现在自带节点。



文章来源: npm install returning error
标签: node.js npm