NPM live-server: command not found
Solution 1
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
Solution 2
The main problem is that node js does not know the path of the installed modules ..
Type this command to get the path of all the global modules.
npm bin -g
It will display the path (C:\Users\gf\AppData\Roaming\npm) and also show (not in PATH env variable)
Copy the path and add it to the path variable of your computer (just like you do while installing other software) for eg : In Windows 7 - Right click on my computer ->select properties -> select advanced system settings -> environment variables
Double click on the Path variable
In the variable value first type a semicolon and paste the path which you copied and that's it every thing should work now..
Solution 3
In my case (Ubuntu with npm installed from package) live-server
module was not installed. It helps:
npm install -g live-server
Solution 4
Just a note, don't just blindly copy and paste the path /Users/username be sure you do the
npm bin -g
as explained by others and get that actual path into export PATH=$PATH:/YourActualPathHERE
Solution 5
try to install as root/Administrator
sudo npm install -g live-server
Hope this will solve your problem.. its works for me...
Timidfriendly
Updated on July 30, 2021Comments
-
Timidfriendly almost 3 years
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 errorbash: live-server: command not found
after commandlive-server
Everything is correctly installed:
/Users/username/npm-global/bin/live-server -> /Users/username/npm-global/lib/node_modules/live-server/live-server.js [email protected] /Users/username/npm-global/lib/node_modules/live-server ├── [email protected] ├── [email protected] ├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]) ├── [email protected] ([email protected]) ├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]) ├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected]) ├── [email protected] ([email protected], [email protected], [email protected], [email protected]) ├── [email protected] ([email protected]) ├── [email protected] ([email protected]) └── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
What am I missing here?
-
Timidfriendly about 8 yearsThis did the job. Thanks.
-
ivsuleman over 4 yearsWorked for me as well, Thanks
-
Valy Dia about 4 yearsIf you're using
zsh
, you can add in your~/.zshrc
:path+=('/Users/valydia/.npm-global/bin') export PATH
-
teewuane about 4 yearsWill I need to do this every time I reset my computer if I don't add that to my .bash_profile ?
-
teewuane about 4 yearsAnswering my own question, the answer is yes, yes you do unless you add to your .bash_profile or .zshrc .
-
Dmitry about 3 yearsIt worked but only as a system variable in my case. Thanks for the help! :-)