Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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
[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?

like image 694
Timidfriendly Avatar asked Feb 20 '16 18:02

Timidfriendly


People also ask

How do I use live server command?

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.

Why npm install command not found?

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.

Why npm command is not working on CMD?

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.


5 Answers

try to install as root/Administrator

sudo npm install -g live-server

Hope this will solve your problem.. its works for me...

like image 192
Sanjay Magar Avatar answered Sep 21 '22 17:09

Sanjay Magar


In my case (Ubuntu with npm installed from package) live-server module was not installed. It helps:

npm install -g live-server
like image 27
Lukasz Stelmach Avatar answered Sep 21 '22 17:09

Lukasz Stelmach


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
like image 13
bolav Avatar answered Oct 14 '22 22:10

bolav


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

enter image description here

Double click on the Path variable

enter image description here

In the variable value first type a semicolon and paste the path which you copied and that's it every thing should work now..

like image 13
Ashley Fernandes Avatar answered Oct 14 '22 23:10

Ashley Fernandes


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

like image 7
Christopher Adams Avatar answered Oct 14 '22 23:10

Christopher Adams