执行命令:npm run build 时,提示:npm ERR! Missing script: “build”

1、执行命令:npm run build 时,提示:npm ERR! Missing script: “build”。如图1

执行命令:npm run build 时,提示:npm ERR! Missing script: "build"

图1

PS E:/wwwroot/wshop/platform> 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、查看 package.json 文件,可以确认 scripts 中并未包含 build 脚本。如图2

查看 package.json 文件,可以确认 scripts 中并未包含 build 脚本

图2

{
  "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、根据提示:To see a list of scripts, run: npm run。要查看脚本列表,请运行 npm run。支持:npm run dev、npm run prod。如图3

根据提示:To see a list of scripts, run: npm run。要查看脚本列表,请运行 npm run。支持:npm run dev、npm run prod

图3

PS E:/wwwroot/wshop/platform> 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、执行 npm run dev ,运行成功。如图4

执行 npm run dev ,运行成功

图4

PS E:/wwwroot/wshop/platform> npm run dev

> dev
> npm run development


> development
> mix


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





   Laravel Mix v6.0.39


✔ Compiled Successfully in 127974ms

原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/250323.html

(0)
上一篇 2022年4月29日
下一篇 2022年4月29日

相关推荐

发表回复

登录后才能评论