Node.js的NPM​​安装前preSS未能从注册表获取 [英] Node.js npm install express failed to fetch from registry

查看:280
本文介绍了Node.js的NPM​​安装前preSS未能从注册表获取的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁能帮助我在我尝试启动我的第一个Node.js的服务器?

我试图按照Node.js的教程。

I am attempting to follow a tutorial in Node.js.

已经安装的Node.js和执行 NPM安装,下一条指令是通过运行节点server.js 产生以下错误:

Having installed Node.js and executed npm install, the next instruction is to start the server by running node server.js which generates the following error:

node.js:201
    throw e; // process.nextTick error, or 'error' event on first tick
          ^
Error: Cannot find module 'express'
    at Function._resolveFilename (module.js:332:11)
    at Function._load (module.js:279:25)
    at Module.require (module.js:354:17)
    at require (module.js:370:17)
    at Object.<anonymous> (/home/sisko/Desktop/ExerciseFiles/01/03/start/server.js:1:77)
    at Module._compile (module.js:441:26)
    at Object..js (module.js:459:10)
    at Module.load (module.js:348:32)
    at Function._load (module.js:308:12)
    at Array.0 (module.js:479:10)
sisko@VirtualBox:~/Desktop/ExerciseFiles/01/03/start$ 

这似乎它需要一个模块调用前preSS所以我环顾四周,发现 NPM安装前preSS 命令应该解决这个问题。不过,我得到以下错误:

It seemed it needed a module called express so I looked around and found the npm install express command which should fix the issue. However, I get the following error:

sisko@VirtualBox:~/Desktop/ExerciseFiles/01/03/start$ npm install express

npm http GET https://registry.npmjs.org/express

npm ERR! Error: failed to fetch from registry: express
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 /home/sisko/Desktop/ExerciseFiles/01/03/start/npm-debug.log npm
npm ERR! 
npm ERR! System Linux 3.2.0-52-generic
npm ERR! command "node" "/usr/bin/npm" "install" "express"
npm ERR! cwd /home/sisko/Desktop/ExerciseFiles/01/03/start
npm ERR! node -v v0.6.12
npm ERR! npm -v 1.1.4
npm ERR! message failed to fetch from registry: express
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/sisko/Desktop/ExerciseFiles/01/03/start/npm-debug.log
npm not ok

我想AP preciate任何帮助......我绝对初学者。

I would appreciate any help with this ... I'm an absolute beginner.

感谢。

推荐答案

对于一些人来说运行 NPM配置设置注册表http://registry.npmjs.org/ NPM安装前preSS 似乎解决这​​个问题。

For some people running npm config set registry http://registry.npmjs.org/ before npm install express seems to fix that issue

这篇关于Node.js的NPM​​安装前preSS未能从注册表获取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆