Search code examples
npm

Is there a difference between `npm start` and `npm run start`?


I am able to run both the npm start and npm run start commands. I used create-react-app to create my application. To make configuration changes in the CSS module, I want to run npm eject but it throws an error.

The npm run eject command works however. I'm confused as to why npm eject did not work. Can I configure it to work?

Below is my package.json file:

"scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject"
}

Solution

  • npm test, npm start, npm restart, and npm stop are all aliases for npm run xxx.

    For all other scripts you define, you need to use the npm run xxx syntax.

    See the docs at https://docs.npmjs.com/cli/run-script for more information.