Home > Back-end >  How to run html file on port 8080 through vs code
How to run html file on port 8080 through vs code

Time:11-12

I am trying to run my html file on port 8080 through command 'http-server' but the terminal keeps saying 'command not found'.

I have tried solving this through 'npx http-server' and 'npm install -g http-server' but then I'm told that the 'npx' and 'npm' commands cannot be found as well.

CodePudding user response:

hello friends please make sure you install node js correctly and maybe this article could help

  1. try node -v for check node is install or not
  2. try npm -v for check npm is install or not

NOTE if you are using windows please make sure to add PATH

how to add PATH in windows

  1. search 'Environment Variables' on global search
  2. Choose “Edit system environment variables”.
  3. Click “Environment Variables” in the “Advanced” tab.
  4. In the “System Variables” box, search for Path and edit it to include the path C:\Program Files\nodejs. If you don’t see it there click “New” then add this path. (Note: Depending on your version you may just need to edit and append this path to what’s there by prefixing it with a semicolon. You’ll see the other paths there are also separated by semicolons).

If you are using linux it could be the permission issues

  1. sudo chown -R $(whoami):admin /usr/local/lib/node_modules/

https://linuxhint.com/npm-command-not-found/

  • Related