繁体   English   中英

无法在Ubuntu 11.10中使用npm安装Express

[英]Unable to install Express using npm in Ubuntu 11.10

我正在尝试使用npm在节点安装上安装Express。 我正在本地安装。 我在办公室环境中使用Ubuntu 11.10(即,除了一些知名的端口以外,其他所有端口都将被阻止)。 我正在以用户身份从package.json调用“ npm install”(不是“ sudo”)。 安装失败,并显示以下日志。

评论/解决方案将不胜感激。

    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

全局安装过程中可能有一些过程npm install express -g / npm install -g express需要管理员权限才能在系统文件夹中写入文件。 尝试不全局安装npm install express

这就是我在安装时如何解决的方法:

创建一个名为node的新文件

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

内容:

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

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

再次尝试安装NPM。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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