expressjs / generator

Express' application generator
MIT License
1.82k stars 544 forks source link

bash: express: command not found... #276

Closed richardlrzjw closed 3 weeks ago

richardlrzjw commented 4 years ago

I have followed up with http://expressjs.com/en/starter/generator.html for express application generator, got this issue bash: express: command not found.... Tried on both windows 2016 and RHEL 8 , I got same issue. but fixed windows 2016 issue by add NODE_PATH in environment variable as NODE_PATH=C:\Users\Administrator\AppData\Roaming\npm\node_modules. but no luck on RHEL 8 by using echo 'export NODE_PATH="'$(npm root -g)'"' >> ~/.bash_profile && . ~/.bash_profile to add PATH in bash_profile. when I run which express, I got /usr/bin/which: no express in (/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/root/bin) in deed I do see express in the node_modules in /usr/lib/node_modules, there are two directories one is express and another one is npm. no problem to run node -v and npm -v. lost my idea, any comments?

Thanks in advance

e-l-i-s-e commented 3 years ago

Hi @richardlrzjw, Can you confirm that you first ran the command npm install -g express-generator?

oviecodes commented 3 years ago

@richardlrzjw please run the npm install -g express-generator command. The express command cannot be found without running the above command

richardlrzjw commented 3 years ago

Thanks oviecodes and e-l-i-s-e, yes, that works for me now.