Tag Archives: npm ERR! missing script: build

[Solved] Possible reasons why NPM run build cannot package NPM err! missing script: build

Error: npm ERR! missing script: build,It was later discovered that the scripts parameter in package.json is:
“scripts”: {undefined
“dev”: “vue-cli-service serve”,
“build:prod”: “vue-cli-service build”,
“build:stage”: “vue-cli-service build –mode staging”,
“preview”: “node build/index.js –preview”,
“lint”: “eslint –ext .js,.vue src”,
“test:unit”: “jest –clearCache && vue-cli-service test:unit”,
“test:ci”: “npm run lint && npm run test:unit”,
“svgo”: “svgo -f src/icons/svg –config=src/icons/svgo.yml”
},So the right commands is:
npm run build:prod --report

npm ERR! missing script: build [How to Solve]

webpack-bundle-analyzer

Webpack visualization plug-in is used to check the total number of packages, the volume of each package and the situation inside the package
start viewing

npm run build --report

The result was an error npm ERR! Missing script: build, and then I found that the scripts the parameter in package.json was

"scripts": {
    "dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
    "build:prod": "cross-env NODE_ENV=production env_config=prod node build/build.js",
    "build:sit": "cross-env NODE_ENV=production env_config=sit node build/build.js",
    "lint": "eslint --ext .js,.vue src",
    "test": "npm run lint"
  },

So the right order should be

npm run build:prod --report

Visiting address: http://localhost:8888/

 

npm ERR! missing script: build

webpack-bundle-analyzer

Webpack visualization plug-in is used to check the total number of packages, the volume of each package and the situation inside the package
start viewing

one

npm run build --report

  

Results error NPM err! Missing script: build , later found that the scripts parameter in package.json is

"scripts": {
    "dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
    "build:prod": "cross-env NODE_ENV=production env_config=prod node build/build.js",
    "build:sit": "cross-env NODE_ENV=production env_config=sit node build/build.js",
    "lint": "eslint --ext .js,.vue src",
    "test": "npm run lint"
  },

So the right order should be

one

npm run build:prod --report

  

Visiting address: http://localhost :8888/

Author: happy morning with contentment
link: https://www.jianshu.com/p/6048426282fa
Source: Jianshu
the copyright of Jianshu belongs to the author. For any form of reprint, please contact the author for authorization and indicate the source