没有不值得去解决的问题,也没有不值得去学习的技术!

npm ERR! Missing script: “build” When Running npm run build

When running the command: npm run build, the following prompt appears: npm ERR! Missing script: "build"

1. When running the command: npm run build, the following prompt appears: npm ERR! Missing script: “build”. See Figure 1.

When running the command: npm run build, the following prompt appears: npm ERR! Missing script: "build"
Figure 1
Plaintext

PS E:\wwwroot\object> npm run build
npm ERR! Missing script: "build"
npm ERR!
npm ERR! To see a list of scripts, run:
npm ERR!   npm run

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Lenovo\AppData\Local\npm-cache\_logs\2022-04-15T01_30_16_068Z-debug.log

2. Checking the package.json file confirms that the scripts section does not include a build script. See Figure 2.

Checking the package.json file confirms that the scripts section does not include a build script
Figure 2
JSON

{
  "private": true,
  "scripts": {
    "test": "jest",
    "dev": "npm run development",
    "development": "mix",
    "watch": "mix watch",
    "watch-poll": "mix watch -- --watch-options-poll=1000",
    "hot": "mix watch --hot",
    "production": "mix --production",
    "prod": "npm run production",
    "gh-pages": "gh-pages -d public/docs -r https://github.com/pheye/wdocs.git",
    "analyzer": "NODE_ENV=production npm_config_report=true npm run prod"
  },
  "devDependencies": {
    "@sentry/webpack-plugin": "^1.13.0",
    "babel-core": "^6.26.3",
    "babel-eslint": "^10.1.0",
    "babel-jest": "^25.1.0",
    "babel-plugin-component": "^1.1.1",
    "babel-plugin-import": "^1.13.0",
    "babel-preset-es2015": "^6.24.1",
    "credit-card-type": "^9.1.0",
    "cross-env": "^5.1",
    "eslint": "^6.8.0",
    "eslint-config-airbnb": "^18.1.0",
    "eslint-plugin-import": "^2.20.1",
    "eslint-plugin-jsx-a11y": "^6.2.3",
    "eslint-plugin-react": "^7.19.0",
    "gh-pages": "^3.2.3",
    "jest": "^25.1.0",
    "jest-allure": "^0.1.1",
    "jest-puppeteer": "^4.4.0",
    "laravel-mix": "^6.0.31",
    "laravel-mix-alias": "^1.0.3",
    "laravel-mix-bundle-analyzer": "^1.0.5",
    "laravel-mix-versionhash": "^2.0.1",
    "mockjs": "^1.1.0",
    "popper.js": "^1.12",
    "postcss": "8.3.1",
    "regenerator-runtime": "^0.13.3",
    "resolve-url-loader": "^2.3.1",
    "sass": "1.32.12",
    "sass-loader": "12.3.0",
    "sass-resources-loader": "^2.2.4",
    "slick-carousel": "^1.8.1",
    "terser-webpack-plugin": "5.2.4",
    "vue": "^2.5.17",
    "vue-custom-scrollbar": "^1.4.0",
    "vue-template-compiler": "^2.6.11"
  },
  "dependencies": {
    "@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.5",
    "@babel/plugin-proposal-optional-chaining": "^7.16.5",
    "@sentry/browser": "^5.27.0",
    "@sentry/integrations": "^5.27.0",
    "@stripe/stripe-js": "^1.7.0",
    "axios": "^0.21.1",
    "babel-polyfill": "^6.26.0",
    "better-scroll": "^1.15.2",
    "bootstrap": "^4.6.1",
    "credit-card-type": "^9.1.0",
    "currency-symbol-map": "^4.0.4",
    "element-ui": "^2.13.0",
    "jquery": "^3.5",
    "lazysizes": "^5.2.0",
    "lodash": "^4.17.21",
    "normalize.css": "^8.0.1",
    "puppeteer": "^2.1.1",
    "qs": "^6.10.1",
    "slick-carousel": "^1.8.1",
    "uuid": "^7.0.3",
    "vue-awesome-swiper": "^3.1.3",
    "vue-country-flag": "^2.0.1",
    "vue-custom-scrollbar": "^1.4.0",
    "vue-i18n": "^8.22.2",
    "vue-loader": "15.9.8",
    "vue-phone-number-input": "^1.1.7",
    "vue-social-sharing": "^2.4.7",
    "vue-waterfall2": "^1.10.1",
    "vue-youtube": "^1.4.0",
    "vuex": "^3.1.2"
  }
}


3. Based on the prompt: To see a list of scripts, run: npm run. To view the list of scripts, run npm run. Supported scripts include: npm run dev, npm run prod. See Figure 3.

Based on the prompt: To see a list of scripts, run: npm run. To view the list of scripts, run npm run. Supported scripts include: npm run dev, npm run prod
Figure 3
Plaintext

PS E:\wwwroot\object> npm run
Lifecycle scripts included in undefined:
  test
    jest

available via `npm run-script`:
  dev
    npm run development
  development
    mix
  watch
    mix watch
  watch-poll
    mix watch -- --watch-options-poll=1000
  hot
    mix watch --hot
  production
    mix --production
  prod
    npm run production
  gh-pages
    gh-pages -d public/docs -r https://github.com/pheye/wdocs.git
  analyzer
    NODE_ENV=production npm_config_report=true npm run prod


4. Run npm run dev, and it executes successfully. See Figure 4.

Run npm run dev, and it executes successfully
Figure 4
Plaintext

PS E:\wwwroot\object> npm run dev

> dev
> npm run development


> development
> mix


● Mix █████████████████████████ emitting (98%)
 after emit





   Laravel Mix v6.0.39


✔ Compiled Successfully in 127974ms

关于作者 · 持续学习与技术实践

我是一名拥有 15 年以上开发经验的技术从业者,自 2013 年起持续运营个人技术博客,记录工作与个人项目中遇到的真实问题,以及解决问题过程中的探索、实践和思考。

除了技术写作,我也在持续开发和维护自己的独立项目,探索新技术和新工具在实际场景中的应用。我始终相信,没有不值得去解决的问题,也没有不值得去学习的技术。

如果这篇文章对你有所帮助,欢迎浏览博客中的其他文章,也欢迎交流技术经验与想法。

关于我  ·  GitHub  ·  邮件联系