简体   繁体   中英

Unable to install Express using npm in Ubuntu 11.10

I am trying to install express on my node installation using npm. I am doing a local installation. I am using Ubuntu 11.10 in my office environment (ie other than a few well known ports everything else would be blocked). I am invoking "npm install" from package.json as a user (not 'sudo' ing). The installation is failing with the following logs.

Comments/solution would be appreciated.

    npm http GET http://registry.npmjs.org/express
    npm http GET http://registry.npmjs.org/express
    npm http GET http://registry.npmjs.org/express
    npm http GET http://registry.npmjs.org/range-parser/0.0.4
    npm http GET http://registry.npmjs.org/connect/2.7.2
    npm http GET http://registry.npmjs.org/mkdirp/0.3.3
    npm http GET http://registry.npmjs.org/commander/0.6.1
    npm http GET http://registry.npmjs.org/cookie/0.0.5
    npm http GET http://registry.npmjs.org/buffer-crc32/0.1.1
    npm http GET http://registry.npmjs.org/send/0.1.0
    npm http GET http://registry.npmjs.org/cookie-signature/0.0.1
    npm http GET http://registry.npmjs.org/methods/0.0.1
    npm http GET http://registry.npmjs.org/fresh/0.1.0
    npm http GET http://registry.npmjs.org/debug
    npm http GET http://registry.npmjs.org/connect/2.7.2
    npm http GET http://registry.npmjs.org/range-parser/0.0.4
    npm http GET http://registry.npmjs.org/cookie/0.0.5
    npm http GET http://registry.npmjs.org/commander/0.6.1
    npm http GET http://registry.npmjs.org/mkdirp/0.3.3
    npm http GET http://registry.npmjs.org/send/0.1.0
    npm http GET http://registry.npmjs.org/buffer-crc32/0.1.1
    npm http GET http://registry.npmjs.org/fresh/0.1.0
    npm http GET http://registry.npmjs.org/cookie-signature/0.0.1
    npm http GET http://registry.npmjs.org/methods/0.0.1
    npm http GET http://registry.npmjs.org/debug
    npm http GET http://registry.npmjs.org/connect/2.7.2
    npm http GET http://registry.npmjs.org/range-parser/0.0.4
    npm http GET http://registry.npmjs.org/mkdirp/0.3.3
    npm http GET http://registry.npmjs.org/commander/0.6.1
    npm http GET http://registry.npmjs.org/cookie/0.0.5
    npm http GET http://registry.npmjs.org/buffer-crc32/0.1.1
    npm http GET http://registry.npmjs.org/send/0.1.0
    npm http GET http://registry.npmjs.org/cookie-signature/0.0.1
    npm http GET http://registry.npmjs.org/methods/0.0.1
    npm http GET http://registry.npmjs.org/fresh/0.1.0
    npm http GET http://registry.npmjs.org/debug
    npm http GET http://registry.npmjs.org/commander/-/commander-0.6.1.tgz
    npm ERR! Error: Parse Error
    npm ERR!     at Socket.socketOnData (http.js:1485:20)
    npm ERR!     at TCP.onread (net.js:404:27)
    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!     <npm-@googlegroups.com>

    npm ERR! System Linux 3.0.0-20-generic
    npm ERR! command "nodejs" "/usr/bin/npm" "install"
    npm ERR! cwd /home/nvbalaji/nodejs/hb
    npm ERR! node -v v0.8.21
    npm ERR! npm -v 1.2.12
    npm ERR! code HPE_INVALID_CONSTANT
    npm WARN package.json methods@0.0.1 No README.md file found!
    npm http GET http://registry.npmjs.org/fresh/-/fresh-0.1.0.tgz
    npm ERR! fetch failed http://registry.npmjs.org/commander/-/commander-0.6.1.tgz
    npm ERR! fetch failed http://registry.npmjs.org/fresh/-/fresh-0.1.0.tgz
    npm http GET http://registry.npmjs.org/commander/-/commander-0.6.1.tgz
    npm http GET http://registry.npmjs.org/fresh/-/fresh-0.1.0.tgz
    npm ERR! fetch failed http://registry.npmjs.org/fresh/-/fresh-0.1.0.tgz
    npm ERR! fetch failed http://registry.npmjs.org/commander/-/commander-0.6.1.tgz
    npm http GET http://registry.npmjs.org/fresh/-/fresh-0.1.0.tgz
    npm http GET http://registry.npmjs.org/commander/-/commander-0.6.1.tgz
    npm ERR! fetch failed http://registry.npmjs.org/commander/-/commander-0.6.1.tgz
    npm ERR! fetch failed http://registry.npmjs.org/fresh/-/fresh-0.1.0.tgz
    npm ERR! 
    npm ERR! Additional logging details can be found in:
    npm ERR!     /home/nvbalaji/nodejs/hb/npm-debug.log
    npm ERR! not ok code 0

maybe some processes during global installation npm install express -g / npm install -g express needs admin permissions for writing files in system folders. try not global installation npm install express .

This is how i've worked around it on my installs:

Create a new file called node

:\>gedit /usr/local/bin/node

Contents:

#!/bin/bash
exec /nodejs "$@"

:\>sudo chmod +x /usr/local/bin/node

Try your NPM install again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM