Node build command not working

10,357

Solution 1

You will have to use npm run build because build is an internal built in keyword (see docs here: https://docs.npmjs.com/cli/build).

Therefore:

npm build // refers to built in

and..

npm run build // refers to your script

Solution 2

I think you should use this:

   npm run build
Share:
10,357
h_h
Author by

h_h

Updated on June 04, 2022

Comments

  • h_h
    h_h almost 2 years

    I am using this config in package.json file for running webpack dev server. I want to use a build command as well, but its not working for me

    {
      "name": "Demo",
      "version": "1.0.0",
      "description": "Demo App",
      "main": "index.js",
      "scripts": {
        "start": "webpack-dev-server --hot",
        "build": "webpack --watch"
    },
    

    npm start command works fine, but build isn't