[英]Unable to install node modules
I've installed node on my debian squeeze dedicated server, but i can't install new mode module 我在我的debian squeeze专用服务器上安装了节点,但我无法安装新模式模块
ex : npm install async 例如:npm install async
Results : 结果:
root@....# npm install async
npm http GET https://registry.npmjs.org/async
npm ERR! Error: failed to fetch from registry: async
npm ERR! at /usr/local/lib/node_modules/npm/lib/utils/npm-registry-client/get.js:139:12
npm ERR! at cb (/usr/local/lib/node_modules/npm/lib/utils/npm-registry-client/request.js:32:9)
npm ERR! at Request._callback (/usr/local/lib/node_modules/npm/lib/utils/npm-registry-client/request.js:137:18)
npm ERR! at Request.callback (/usr/local/lib/node_modules/npm/node_modules/request/main.js:109:22)
npm ERR! at Request.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/request/main.js:198:58)
npm ERR! at Request.emit (events.js:88:20)
npm ERR! at ClientRequest.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/request/main.js:356:14)
npm ERR! at ClientRequest.emit (events.js:67:17)
npm ERR! at HTTPParser.onIncoming (http.js:1238:11)
npm ERR! at HTTPParser.onHeadersComplete (http.js:102:31)
npm ERR! You may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-@googlegroups.com>
npm ERR!
npm ERR! System Linux 3.2.13-xxxx-std-ipv6-64
npm ERR! command "node" "/usr/local/bin/npm" "install" "async"
npm ERR! cwd /root
npm ERR! node -v v0.6.8
npm ERR! npm -v 1.1.0-2
npm ERR! message failed to fetch from registry: async
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /root/npm-debug.log
npm not ok
UPDATE (1/11/2015): 更新(2015年1月11日):
I now use NVM to manage my node/npm installation on both Linux and Unix. 我现在使用NVM在Linux和Unix上管理我的node / npm安装。 It's super simple; 它非常简单; just follow these steps. 只需按照以下步骤操作
Install NVM. 安装NVM。
$ curl https://raw.githubusercontent.com/creationix/nvm/v0.22.1/install.sh | bash
Use NVM to install the latest stable version of node and NPM. 使用NVM安装最新稳定版本的节点和NPM。
$ nvm install stable
Tell NVM to use the stable version as the default version in future bash instances. 告诉NVM在将来的bash实例中使用稳定版本作为默认版本。
$ nvm alias default stable
Now you're all set with node & NPM. 现在你们都设置了节点和NPM。 NVM even gets rid of the permissions issues with NPM global modules on Ubuntu, which normally requires you to chown
or sudo
and causes all sorts of frustration. NVM甚至摆脱了Ubuntu上的NPM全局模块的权限问题,这通常需要你chown
或sudo
并引起各种各样的挫败感。 You can use NVM to install different versions of node/NPM side by side as well. 您也可以使用NVM并排安装不同版本的node / NPM。 You can switch between installed versions with nvm use {version}
, as long as you've done nvm install {version}
already. 只要您已经完成nvm install {version}
就可以使用nvm use {version}
在已安装的版本之间切换。
I think you may be running a really old version of node & npm. 我想你可能正在运行一个非常旧版本的node&npm。 I see that node is v0.6.8 and npm is 1.1.0-2 when the current versions are 0.10.26 & 1.4.6 respectively. 当前版本分别为0.10.26和1.4.6时,我看到节点为v0.6.8,npm为1.1.0-2。 I'd try upgrading your node and npm installs and then try installing modules again and see if that fixes it for you. 我尝试升级你的节点和npm安装,然后再次尝试安装模块,看看是否为你修复了它。
Head over to http://nodejs.org and click the big green button in order to get the node installer. 转到http://nodejs.org并单击绿色大按钮以获取节点安装程序。 It will install both node & npm together. 它将同时安装node和npm。
Note: It's sometimes better not to install node/npm from a package manager unless you're confident the version listed in the package manager is the latest version. 注意:有时最好不要从软件包管理器安装node / npm,除非您确信软件包管理器中列出的版本是最新版本。 It's important to keep npm up to date. 让npm保持最新非常重要。 Npm even updates itself along with all your global node modules when you run npm update -g
. 当您运行npm update -g
时,Npm甚至会自动更新所有全局节点模块。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.