質問

I've installed node on my debian squeeze dedicated server, but i can't install new mode module

ex : 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):
I now use NVM to manage my node/npm installation on both Linux and Unix. It's super simple; just follow these steps.

  1. Install NVM.

    $ curl https://raw.githubusercontent.com/creationix/nvm/v0.22.1/install.sh | bash
    
  2. Use NVM to install the latest stable version of node and NPM.

    $ nvm install stable
    
  3. Tell NVM to use the stable version as the default version in future bash instances.

    $ nvm alias default stable
    

Now you're all set with node & 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. You can use NVM to install different versions of node/NPM side by side as well. You can switch between installed versions with nvm use {version}, as long as you've done nvm install {version} already.


I think you may be running a really old version of 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. I'd try upgrading your node and npm installs and then try installing modules again and see if that fixes it for you.

Head over to http://nodejs.org and click the big green button in order to get the node installer. It will install both node & npm together.

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. It's important to keep npm up to date. Npm even updates itself along with all your global node modules when you run npm update -g.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top