Timidfriendly Timidfriendly - 1 month ago 15
Node.js Question

NPM live-server: command not found

I install live-server globally with:

npm install -g live-server
but for some reason it is not be found and I get the following error

bash: live-server: command not found
after command
live-server


Everything is correctly installed:

/Users/username/npm-global/bin/live-server ->
/Users/username/npm-global/lib/node_modules/live-server/live-server.js
live-server@0.9.2 /Users/username/npm-global/lib/node_modules/live-server
├── object-assign@4.0.1
├── colors@1.1.2
├── event-stream@3.3.2 (pause-stream@0.0.11, duplexer@0.1.1, stream-combiner@0.0.4, from@0.1.3, map-stream@0.1.0, split@0.3.3, through@2.3.8)
├── opn@4.0.0 (pinkie-promise@2.0.0)
├── send@0.13.1 (escape-html@1.0.3, destroy@1.0.4, statuses@1.2.1, etag@1.7.0, fresh@0.3.0, range-parser@1.0.3, ms@0.7.1, debug@2.2.0, depd@1.1.0, mime@1.3.4, on-finished@2.3.0, http-errors@1.3.1)
├── morgan@1.7.0 (on-headers@1.0.1, basic-auth@1.0.3, depd@1.1.0, on-finished@2.3.0, debug@2.2.0)
├── connect@3.4.1 (utils-merge@1.0.0, parseurl@1.3.1, debug@2.2.0, finalhandler@0.4.1)
├── faye-websocket@0.10.0 (websocket-driver@0.6.4)
├── watchr@2.3.10 (bal-util@1.18.0)
└── serve-index@1.7.3 (parseurl@1.3.1, escape-html@1.0.3, batch@0.5.3, http-errors@1.3.1, debug@2.2.0, mime-types@2.1.10, accepts@1.2.13)


What am i missing here?

Answer

Add the path to your npm installation to your path. Just add this line at the end of .bash_profile. Run it in bash first, to make sure it works before putting it in .bash_profile

export PATH=$PATH:/Users/username/npm-global/bin
Comments