0

Anytime I try to run "live-server", I'm getting "bash: live-server: command not found" I ran "npm install live-server -g" and "sudo npm install live-server -g" to install globally.

It was working fine before and then I started getting this issue. Not building anything just working on a JS course on Udemy. Total beginner, pretty lost

I tried reinstalling, restarting VS code, restarting my computer, etc. Zero luck

  • Total shot in the dark, but does your version of node change for some reason? You can check it with `node -v` after installing `live-server` and then again when it goes missing – Mike Szyndel Mar 25 '23 at 10:46
  • From what I've noticed the version has been the same but I'll try again – JHairCode Mar 30 '23 at 00:55
  • Running node -v returns the same version regardless. I just tried uninstalling and reinstalling again, running node -v to see the version. Then running live-server again, still get "command not found" – JHairCode Mar 30 '23 at 01:15
  • https://imgur.com/a/UDaI5aX – JHairCode Mar 30 '23 at 01:33
  • are you supposed to install npm packaged with `sudo`? https://medium.com/@ExplosionPills/dont-use-sudo-with-npm-5711d2726aa3 – Mike Szyndel Mar 31 '23 at 12:00
  • I just use it because in some courses I've taken they've said sometimes you might need to use it as a Mac user. I'll try running it again without. But the issue has persisted regardless – JHairCode Apr 01 '23 at 02:28
  • Trying without sudo, same result. Install globally, run "live-server", get "command not found" – JHairCode Apr 01 '23 at 02:40
  • Ok. You need to learn to read error messages, it's a very important thing for developers. In your screenshot npm tell you it wants to rename/copy a directory and it can't because it already exists (probably from a previous reinstallation). You need to remove that directory. Can you do it? – Mike Szyndel Apr 01 '23 at 07:33
  • I see. Okay, I'll work on that. Still pretty new to the CL. So I'll work on removing that. – JHairCode Apr 02 '23 at 18:36
  • So I've messed around and solved the "command not found" issue. live server will launch now when I run "live-server". My issue now, is when it opens the browser window, it never fully loads the page. The "loading" circle just spins continuously until you get a "page unresponsive" prompt. Seems I'm making progress but not all the way there. Also never loads to a point in which I can even open the console – JHairCode Apr 02 '23 at 19:44
  • My first guess would be that “page unresponsive” means there’s an infinite loop somewhere – Mike Szyndel Apr 02 '23 at 20:02
  • Hmm that would make sense. I’ll look into it. Thanks for your help Mike – JHairCode Apr 05 '23 at 16:30
  • I seem to have found it. Looks like it is back to normal. Thanks Mike!! – JHairCode Apr 05 '23 at 23:56

0 Answers0