Search code examples
javascriptlite-server

Lite-server not working


I had a project that was previously using lite-server. I can no longer get it to run using

npm run

I see the following from the console

PS C:\Users\XXX\Documents\Work\Repos\Homepage_Slider> npm run Lifecycle scripts included in homepage_slider: test echo "Error: no test specified" && exit 1 start lite-server

I don't really understand why this isn't working anymore.

I've tried:

  • Updating NPM
  • Running lite-server globably
  • Make sure package.json is set up correctly

Here is my package.json file

{
  "name": "homepage_slider",
  "version": "1.0.0",
  "description": "A simple slider for homepage",
  "main": "index.html",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "lite-server"
  },
  "repository": {
    "type": "git",
    "url": "XXX"
  },
  "keywords": [
    "Slider"
  ],
  "author": "XXX",
  "license": "ISC",
  "devDependencies": {
    "lite-server": "^2.3.0"
  },
  "dependencies": {
    "npm": "^6.0.1"
  }
}

Solution

  • npm run is a reserved word for npm itself. Check the documentation

    What you really need is npm start which is a shortcut for npm run start which is a shortcut for npm run-script start!