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
[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?
Shortcuts to Start/Stop Server Open a HTML file and right-click on the editor and click on Open with Live Server . Open the Command Pallete by pressing F1 or ctrl+shift+P and type Live Server: Open With Live Server to start a server or type Live Server: Stop Live Server to stop a server.
In most cases, this type of error occurs when the system cannot find the path where npm or NodeJS is installed. This could be because you don't have npm or NodeJS installed on your system or haven't configured the PATH to binaries.
The error “npm is not recognized as an internal or external command” error may occur because either the npm is not installed or it is not added to the windows path. To resolve this error, the first solution is to install Node. js on Windows as Node. js is equipped with npm by default.
try to install as root/Administrator
sudo npm install -g live-server
Hope this will solve your problem.. its works for me...
In my case (Ubuntu with npm installed from package) live-server
module was not installed. It helps:
npm install -g live-server
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
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..
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With