node.js安装express框架时出现command not found问题

在安装nodejs的web框架express时遇到的问题及解决方案。

安装时在文件夹下输入:

1
npm install -g express

但是无法使用express命令,出现express: command not found。原因在于在express4.0中,cli需要单独安装才能使用,cli功能被包含在express-generator package中。

因此需要如下操作:

1
npm install -g express-generator

参考: http://stackoverflow.com/questions/23002448/express-command-not-found