Reputation: 3284
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?
Upvotes: 14
Views: 35961
Reputation: 1
npm install -g http-server
http-server
Set-ExecutionPolicy RemoteSigned -Scope Process
npm install -g live-server
live-server
Upvotes: 0
Reputation: 69
My npm live-server works well until it suddenly stopped without any error. I then must change to use live-server of Visual Studio code instead. After read many article i found that my path variable missing C:\Windows\System32\ variable. Check carefully your path environment variable to make sure you have all the addresses needed.
Upvotes: 0
Reputation: 49
Just try to use live-server in your project as a dev-dependency. Yes, it is not the recommended way. But it is a shortcut and will save your precious time.
Upvotes: 0
Reputation: 177
If you on windows 10.
Assuming Nodejs is installed, npm is installed, GitBash terminal is installed
1.Install Linux subsystem for windows: Open PowerShell and type:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
Open gitBash.exe terminal and type: $ npm bin -g
Copy the Path: C:\Users\YourMachineName\AppData\Roaming\npm
5.Click the search icon and type Environment...
6.Choose Edit environment variables for your account
Upvotes: 1
Reputation: 990
Update to http-server. You can install globally using
npm install --global http-server
You can find the docs at https://www.npmjs.com/package/http-server
Upvotes: 0
Reputation: 5391
In my case (Ubuntu with npm installed from package) live-server
module was not installed. It helps:
npm install -g live-server
Upvotes: 7
Reputation: 1290
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
Upvotes: 7
Reputation: 1207
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..
Upvotes: 14
Reputation: 121
try to install as root/Administrator
sudo npm install -g live-server
Hope this will solve your problem.. its works for me...
Upvotes: 6
Reputation: 6998
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
Upvotes: 13