0

I know there are many answers in this topic but still not solved my problem.

My settings:

  • Mac OS
  • Node.js v8.11.2
  • npm v5.6.0

I tried this:

  • sudo npm install -g express-generator from here
  • reinstall node.js from here
  • express install after npm init. (But just 'package.json' is made when I finish this tutorial)

When I install express and express-generator,

$ npm install -g express
+ express@4.16.3
updated 1 package in 1.499s

$ npm install -g express-generator
/Users/soodiamond/.npm-global/bin/express -> 
/Users/soodiamond/.npm-global/lib/node_modules/express-generator/bin/express-cli.js
+ express-generator@4.16.0
updated 1 package in 0.925s

still not find express command

$ express myapp
-bash: express: command not found
SooJungChae
  • 219
  • 1
  • 4
  • 16

2 Answers2

1

Module express don't have bin in package.json, so you can't call it. (npm don't create file express in bin folder)

When you run : sudo npm install -g express-generator,

hong4rc
  • 3,999
  • 4
  • 21
  • 40
  • Thanks @kỉaT I tried to call `express-generator` but error is same. `-bash: express-generator: commant not found` – SooJungChae Jun 08 '18 at 07:02
  • 1
    Sorry you, when install `express-generator` you can call `express`. You should check bin folder (I don't use Mac OS, so i don't know path of bin folder). – hong4rc Jun 09 '18 at 04:57
  • Yes that's my path problem. I found express folder path is not registered in $PATH. When I added it then works. – SooJungChae Jun 11 '18 at 04:56
1

I had the exact same problem while installing express for the first time. Probably the @4.16 version has some issues.
Try:
sudo npm install -g express@4.13.1

Worked for me!