This is the 11th day of my participation in Gwen Challenge

NPM run dev or NPM run start or Yarn examples:start Error: Webpack Dev Server Invalid Options error: Webpack Dev Server Invalid Options error: Webpack Dev Server Invalid Options

The error message

First, the following error message is displayed when you run the Vue project:

Cheng$NPM run start > [email protected] start /Users/Cheng/hnant > vue-cli-service serve INFO Starting development server...  WARN A new version of sass-loader is available. Please upgrade for best experience. ERROR ValidationError: webpack Dev Server Invalid Options options.proxy should be {Object|Array} (https://webpack.js.org/configuration/dev-server/#devserverproxy) ValidationError: webpack Dev Server Invalid Options options.proxy should be {Object|Array} (https://webpack.js.org/configuration/dev-server/#devserverproxy) at validateOptions (/ Users/Cheng/hnant/node_modules / _schema - [email protected] @ schema - utils/SRC/validateOptions js: thus says) at the new Server (/ Users/Cheng/hnant/node_modules / _webpack - [email protected] @ webpack - dev - server/lib/server js: 57:5) at serve (/ Users/Cheng/hnant/node_modules / _ @ [email protected] @ @ vue/cli - service/lib/commands/serve. Js: 172:20) at process._tickCallback (internal/process/next_tick.js:68:7) at Function.Module.runMain (internal/modules/cjs/loader.js:832:11) at startup (internal/bootstrap/node.js:283:19) at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] start: 'vue-cli-service serve' NPM ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] start script.npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! /Users/Cheng/.npm/_logs/2021-03-01T01_05_47_996Z-debug.logCopy the code

The analysis reason

According to the above error message, the cause of the above problem is that the proxy used to solve the cross-domain problem in the project configuration file config.js is empty, which causes the above error.

The solution

Module. exports/devServer/config.js/devServer/module. Exports/config.js/devServer/module.

And then just comment out or delete the proxy,

Then save the file and re-run the project to solve the problem perfectly.

The above is all the content of this chapter. Welcome to pay attention to the wechat public account of Sanzhan “Program Ape by Sanzhan”, and the Sina Weibo account of Sanzhan “Sanzhan 666”, welcome to pay attention!