Search code examples
node.jsnpmlite-server

Getting Error While starting lite-server in npm


i did a fresh "npm init". put entry point : "index.html"

then installed lite-server : npm install lite-server --save-dev

also updated the package.json and I Uninstalled, reinstalled tried everything but it's not working and

also tried npm cache clean --force but it's not working. can any one help with this error.

    {
  "name": "git-test",
  "version": "1.0.0",
  "description": "",
  "main": "index.html",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "npm run lite",
    "lite": "lite-server"
  },
  "author": "Sateesh",
  "license": "ISC",
  "dependencies": {
    "lite-server": "^2.5.4"
  }
}

But when I did "npm start" , getting this error

 [email protected] start D:\Coursera\git-test
> npm run lite
'npm' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `npm run lite`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\sai\AppData\Roaming\npm-cache\_logs\2020-06-05T10_20_11_723Z-debug.log 

Solution

  • You don't seem to have node/npm installed and configured properly (PATH issues).

    I would suggest you try to re-install Node.js using the official instructions for your platform (https://nodejs.org/en/download/) or by using a Node.js version manager like nvm (https://github.com/nvm-sh/nvm) or n (https://github.com/tj/n).

    Using nvm or n, will allow you to dynamically switch Node.js version without having to re-install everything from scratch.