For some reason after installing Express globally on my machine with npm install -g express
if I cd
into a directory and try to run express I get t
I was having this challenge for a number of days. After deep search, I learned that one has to read every available resource especially from the parent source [in this case EXPRESSJS.COM]. Here is a quick fix.
Beginning with version 4.0+ you don't necessarily need to install express-generator if you are running Node 8.2+. Simply run
npx express-generator
The express-generator will run just the way it runs when you run:express
For more details see Getting Started
Happy reading and research hours.
You need to run:
npm install -gd express-generator
The original express with cli, now the cli split into separate express-generator package. Originally generated by the project is running express node app.js, because httpserver relevant code in app.js, and now this part of the code to the project directory bin/www
below, app.js retain only achieve app logic code, you need to run the bin/www
. Just a very simple application and refinement package dependency version changes.
With the release of Express 4.0.0 it looks like you need to do sudo npm install -g express-generator
.
I have been recently trying to install express-generator , however it would give out ,
$ zsh : command not found : express
It was after i did
$ sudo npm install -g express
$ sudo npm install -g express-generator
But then , i saw the console log of the npm install commnand
/usr/local/Cellar/node/13.1.0/bin/express -> /usr/local/Cellar/node/13.1.0/lib/node_modules/express-generator/bin/express-cli.js
which gave a hint that the executable express is in the bin folder.
So the solution is : Open up ~/.zshrc or ~/.bashrc and export the path as follows:
export PATH=/usr/local/Cellar/node/13.1.0/bin:$PATH
It works now.