1

I get the error mentioned above in the title, after installing http server on my OSX with

npm install http-server -g

It installed it in

/usr/local/bin/http-server -> /usr/local/lib/node_modules/http-server/bin/http-server
/usr/local/bin/hs -> /usr/local/lib/node_modules/http-server/bin/http-server
/usr/local/lib

I tried adding a path since I saw that as a suggestion here like this

 PATH=$PATH:/usr/local/lib/node_modules/http-server
Community
  • 1
  • 1
Ludwig
  • 1,401
  • 13
  • 62
  • 125

2 Answers2

1

You are on linux environment. Try This command to export path

export NODE_PATH=$NODE_PATH:/usr/local/lib/node_modules/

Then run your app.

bilalmetla
  • 155
  • 12
1

On OS X / linux(ubuntu 16.04) environment. I solved this problem by using follow command

sudo npm -g install http-server

sudo npm install -g http-server

JP W
  • 11
  • 2