在ubuntu下安装express出来的问题,求解。
发布于 12 年前 作者 1998763 7373 次浏览 最后一次编辑是 8 年前

之前在window下来学习node,最近想换在ubuntu来学习。。不过在安装express的时候老不行,也不知道是怎么回事,求指点! 安装express: npm http GET https://registry.npmjs.org/express npm http 200 https://registry.npmjs.org/express npm http GET https://registry.npmjs.org/express/-/express-3.0.5.tgz npm http 200 https://registry.npmjs.org/express/-/express-3.0.5.tgz npm http GET https://registry.npmjs.org/connect/2.7.1 npm http GET https://registry.npmjs.org/commander/0.6.1 npm http GET https://registry.npmjs.org/range-parser/0.0.4 npm http GET https://registry.npmjs.org/mkdirp/0.3.3 npm http GET https://registry.npmjs.org/cookie/0.0.5 npm http GET https://registry.npmjs.org/buffer-crc32/0.1.1 npm http GET https://registry.npmjs.org/fresh/0.1.0 npm http GET https://registry.npmjs.org/methods/0.0.1 npm http GET https://registry.npmjs.org/send/0.1.0 npm http GET https://registry.npmjs.org/debug npm http GET https://registry.npmjs.org/cookie-signature/0.0.1 npm http 304 https://registry.npmjs.org/range-parser/0.0.4 npm http 304 https://registry.npmjs.org/debug npm http 304 https://registry.npmjs.org/mkdirp/0.3.3 npm http 304 https://registry.npmjs.org/send/0.1.0 npm http 304 https://registry.npmjs.org/buffer-crc32/0.1.1 npm http 304 https://registry.npmjs.org/cookie/0.0.5 npm http 304 https://registry.npmjs.org/connect/2.7.1 npm http 200 https://registry.npmjs.org/commander/0.6.1 npm http 304 https://registry.npmjs.org/methods/0.0.1 npm http 304 https://registry.npmjs.org/fresh/0.1.0 npm http 304 https://registry.npmjs.org/cookie-signature/0.0.1 npm http GET https://registry.npmjs.org/commander/-/commander-0.6.1.tgz npm http 200 https://registry.npmjs.org/commander/-/commander-0.6.1.tgz npm http GET https://registry.npmjs.org/mime/1.2.6 npm http GET https://registry.npmjs.org/qs/0.5.1 npm http GET https://registry.npmjs.org/formidable/1.0.11 npm http GET https://registry.npmjs.org/crc/0.2.0 npm http GET https://registry.npmjs.org/bytes/0.1.0 npm http GET https://registry.npmjs.org/pause/0.0.1 npm http 304 https://registry.npmjs.org/pause/0.0.1 npm http 304 https://registry.npmjs.org/formidable/1.0.11 npm http 304 https://registry.npmjs.org/qs/0.5.1 npm http 304 https://registry.npmjs.org/bytes/0.1.0 npm http 304 https://registry.npmjs.org/crc/0.2.0 npm http 304 https://registry.npmjs.org/mime/1.2.6

显示:

tears@ubuntu:~/Desktop/text$ express text -e /usr/bin/env: node: No such file or directory

在安装express的时候http返回的是304,不知道跟这个有没有关。

9 回复

你是如何安装express的? 正常情况下,安装了node之后,自动安装了npm,然后你使用npm install express -g安装。 如果之前安装有错误,先使用npm cache clean,再安装。 如果是源的问题,建议搜下清华rpm源,并找下换源方法。

分别运行以下两条命令,看看结果如何:

node -v
/usr/bin/env node -v

用你的方法npm cache clean后再装感觉可以了,因为http返回的是200,但依久不用,然后我再用npm install -g supervisor,使用supervisor text.js也有同样的提示。node: No such file or directory。

用node -V不行,用> tears@ubuntu:~/Desktop/text$ nodejs -v v0.6.19 tears@ubuntu:~/Desktop/text$ /usr/bin/env nodejs -v v0.6.19

@1998763 你是你安装node.js的问题了。 大家都是用__node__的,你偏要改成__nodejs__ 自己进去 node_modules/express/bin 目录,改express文件的第一行吧

@leizongmin 不是我改的,是装了node之后就这样啦,本来用node不行,我就想可能是在ubuntu里不一样,就试了下nodejs,居然可以。。也就不理它了。

我也遇到了这样的问题,现在坐等有人帮忙解决

楼上说的很对呀,我去 /usr/local/lib/node_modules/express/bin 目录,改express文件的第一行 ,如下: #!/usr/bin/env nodejs
就好了,ubuntu貌似为了避免包的冲突,nodejs装完了,会自己改成nodejs

@coocon 楼上很牛逼啊

回到顶部