简体   繁体   English

在Ubuntu上安装Express-Generator时出错

[英]Getting error while installing express-generator on ubuntu

I am getting error while installing express-generator 安装Express-Generator时出现错误

sudo npm install -g express-generator
npm http GET https://registry.npmjs.org/express-generator
npm http 304 https://registry.npmjs.org/express-generator
npm http GET https://registry.npmjs.org/commander/2.7.1
npm http GET https://registry.npmjs.org/mkdirp/0.5.1
npm http GET https://registry.npmjs.org/sorted-object/1.0.0
npm http 304 https://registry.npmjs.org/commander/2.7.1
npm http 304 https://registry.npmjs.org/mkdirp/0.5.1
npm http 304 https://registry.npmjs.org/sorted-object/1.0.0
npm http GET https://registry.npmjs.org/graceful-readlink
npm http GET https://registry.npmjs.org/minimist/0.0.8
npm http 304 https://registry.npmjs.org/graceful-readlink
npm http 304 https://registry.npmjs.org/minimist/0.0.8
/usr/local/bin/express -> /usr/local/lib/node_modules/express-generator/bin/express
express-generator@4.13.1 /usr/local/lib/node_modules/express-generator
├── sorted-object@1.0.0
├── commander@2.7.1 (graceful-readlink@1.0.1)
└── mkdirp@0.5.1 (minimist@0.0.8)

I think this is why I can not use express command on terminal. 我认为这就是为什么我不能在终端上使用express命令的原因。

it is giving me below error while running command 它在运行命令时给我以下错误

$ express -h 
bash: /usr/bin/express: No such file or directory

I am using ubuntu 14.04. 我正在使用Ubuntu 14.04。

can anyone shade light on this? 任何人都可以在上面遮荫吗? why i am getting 304? 为什么我要304?

You need to install express. 您需要安装快递。 Try: 尝试:

npm install -g express
/usr/local/bin/express -> /usr/local/lib/node_modules/express-generator/bin/express


bash: /usr/bin/express: No such file or directory

These two lines are not matching obviously. 这两行显然不匹配。 So, as a quick solution, you can try to link them manually by ln : 因此,作为一种快速的解决方案,您可以尝试通过ln手动链接它们:

[sudo] ln -s /usr/local/lib/node_modules/express-generator/bin/express /usr/bin/express


The other question, "can anyone shade light on this? why i am getting 304?" 另一个问题是,“有人可以对此加以遮蔽吗?为什么我要304?”

304 means "resource has not been modified since last requested", so nothing to worry about it. 304表示“自上次请求以来尚未修改资源”,因此无需担心。 Since you installed it before and it hasn't change until your next install, you're getting this http status code. 由于您之前已经安装了它,并且直到下一次安装它都没有改变,因此您将获得此http状态代码。

304 status code: 304状态码:

If the client has done a conditional GET and access is allowed, but the document has not been modified since the date and time specified in If-Modified-Since field, the server responds with a 304 status code and does not send the document body to the client. 如果客户端已执行条件GET并允许访问,但自If-Modified-Since字段中指定的日期和时间以来未对文档进行修改,则服务器将以304状态代码响应,并且不将文档正文发送到客户端。

So as you can see, it is not an error. 如您所见, 这不是错误。

You can find more details about status codes at http://www.w3.org/Protocols/HTTP/HTRESP.html 您可以在http://www.w3.org/Protocols/HTTP/HTRESP.html上找到有关状态代码的更多详细信息

Note: Not only this module, but almost all modules will show 304 status code when installing. 注意:安装时,不仅此模块,而且几乎所有模块都将显示304状态代码。

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

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