npm表示不安装命令

时间:2014-10-10 08:01:37

标签: node.js npm

我有一台mac,我运行以下代码将express安装为全局:

sudo npm install -g express

这是给出以下输出

new-host:nodetraining admin$ sudo npm install -g express
express@4.9.6 /usr/local/lib/node_modules/express
├── merge-descriptors@0.0.2
├── utils-merge@1.0.0
├── cookie@0.1.2
├── fresh@0.2.4
├── escape-html@1.0.1
├── range-parser@1.0.2
├── cookie-signature@1.0.5
├── finalhandler@0.2.0
├── vary@1.0.0
├── media-typer@0.3.0
├── parseurl@1.3.0
├── methods@1.1.0
├── serve-static@1.6.4
├── path-to-regexp@0.1.3
├── depd@0.4.5
├── qs@2.2.4
├── on-finished@2.1.0 (ee-first@1.0.5)
├── etag@1.4.0 (crc@3.0.0)
├── debug@2.0.0 (ms@0.6.2)
├── send@0.9.3 (destroy@1.0.3, ms@0.6.2, mime@1.2.11)
├── proxy-addr@1.0.3 (forwarded@0.1.0, ipaddr.js@0.1.3)
├── accepts@1.1.1 (negotiator@0.4.8, mime-types@2.0.2)
└── type-is@1.5.2 (mime-types@2.0.2)
new-host:nodetraining admin$

但是它没有安装命令模块,所以我不能使用以下命令:

express <projectname>

当我尝试使用express命令时会发生这种情况:

new-host:nodetraining admin$ express airline
-bash: express: command not found
new-host:nodetraining admin$

有人可以帮忙吗?

2 个答案:

答案 0 :(得分:1)

您需要安装Express Generator才能获得express命令。我也对此感到困惑;)

答案 1 :(得分:0)

您需要全局安装Express Generator才能使用命令

npm install -g express-generator