Johhan Santana
Johhan Santana

Reputation: 2415

npm install express-generator not installing express

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

I run this:

npm install -g express-generator

and this is my results:

username@username-Inspiron-3521:~$ npm install -g express-generator
/home/username/npm/bin/express -> /home/username/npm/lib/node_modules/express-generator/bin/express
[email protected] /home/username/npm/lib/node_modules/express-generator
├── [email protected]
├── [email protected] ([email protected])
└── [email protected] ([email protected])

but when I do

express --ejs flapper-news

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

what am I doing wrong?

Thanks for the time.

edit

When i do 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

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

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

edit3

This is my .bashrc file:

### 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

Upvotes: 3

Views: 5154

Answers (2)

Piotr Jaworski
Piotr Jaworski

Reputation: 584

Excuse me for an obvious question, but I have to be sure - do you run $ npm install in the directory that contains the package.json file? After you create the app with express --ejs flapper-news, you are supposed to cd flapper-news before npm install, did you?

Upvotes: 0

piemonkey
piemonkey

Reputation: 751

Looking at this line from your output for npm install -g express generator

/home/username/npm/bin/express -> /home/username/npm/lib/node_modules/express-generator/bin/express

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

Upvotes: 5

Related Questions