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
- try node -v for check node is install or not
- 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
- search 'Environment Variables' on global search
- Choose “Edit system environment variables”.
- Click “Environment Variables” in the “Advanced” tab.
- 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
- sudo chown -R $(whoami):admin /usr/local/lib/node_modules/