npm install express-generator 没有安装 express

npm install express-generator not installing express

我正在学习 MEAN 堆栈教程,该教程要求我进行快速安装:

我运行这个:

npm install -g express-generator

这是我的结果:

username@username-Inspiron-3521:~$ npm install -g express-generator
/home/username/npm/bin/express -> /home/username/npm/lib/node_modules/express-generator/bin/express
express-generator@4.13.1 /home/username/npm/lib/node_modules/express-generator
├── sorted-object@1.0.0
├── mkdirp@0.5.1 (minimist@0.0.8)
└── commander@2.7.1 (graceful-readlink@1.0.1)

但当我这样做时

express --ejs flapper-news

The program 'express' is currently not installed. You can install it by typing:
sudo apt-get install node-express

我做错了什么?

谢谢你的时间。

编辑

当我做的时候npm install

username@username-Inspiron-3521:~/Documents/mean/flapper_news$ npm install
npm ERR! install Couldn't read dependencies
npm ERR! Linux 3.16.0-51-generic
npm ERR! argv "/home/username/local/bin/node" "/home/username/local/bin/npm" "install"
npm ERR! node v4.2.1
npm ERR! npm  v2.14.7
npm ERR! path /home/username/Documents/mean/flapper_news/package.json
npm ERR! code ENOPACKAGEJSON
npm ERR! errno -2
npm ERR! syscall open

npm ERR! package.json ENOENT: no such file or directory, open '/home/username/Documents/mean/flapper_news/package.json'
npm ERR! package.json This is most likely not a problem with npm itself.
npm ERR! package.json npm can't find a package.json file in your current directory.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/username/Documents/mean/flapper_news/npm-debug.log

edit2

在 运行ning npm install -g express 并输入 express -v 之后,我得到了这个:

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

edit3

这是我的 .bashrc 文件:

### Added by the Heroku Toolbelt
export PATH="/usr/local/heroku/bin:$PATH"

export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
export PATH=$HOME/local/bin:$PATH
export NODE_PATH=/usr/lib/nodejs:/usr/lib/node_modules:/usr/share/javascript:/home/username/npm/lib/node_modules
export PATH=/home/username/Android/Sdk/platform-tools:$PATH
export PATH=/home/username/Android/Sdk/tools:$PATH

npm install -g express generator

的输出中查看这一行
/home/username/npm/bin/express -> /home/username/npm/lib/node_modules/express-generator/bin/express

您的 npm 正在您的主目录中安装全局模块,并将二进制链接放置在 /home/username/npm/bin 目录中,因此您需要将其添加到您的路径中。将此添加到您的 .bashrc:

export PATH=$HOME/npm/bin:$PATH

请问一个显而易见的问题,但我必须确定 - 您 运行 $ npm install 在包含 package.json 文件的目录中吗?使用 express --ejs flapper-news 创建应用程序后,您应该在 npm install 之前 cd flapper-news,是吗?