npm install express-generator不安装Express [英] npm install express-generator not installing express

查看:238
本文介绍了npm install express-generator不安装Express的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在遵循MEAN堆栈教程,该教程要求我已安装Express:

I'm following a MEAN stack tutorial that requires me to have express installed:

我运行这个:

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

运行npm install -g express并键入express -v后,我得到了:

after running npm install -g express and typing express -v I get this:

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:

Your npm is installing global modules within your home directory and it's placing binary links in the /home/username/npm/bin directory, so you'll need to add this to your path. Add this to your .bashrc:

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

这篇关于npm install express-generator不安装Express的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆