Arti Singh
Arti Singh

Reputation: 401

How to fix "webpack Dev Server Invalid Options" in Vuejs

I am using @vue/cli v3.7.0 and I created a project by vue create myapp with Babel + Router + node-sass and my project got installed successfully

But when I ran npm run serve (in the project directory) I got following error:


 INFO  Starting development server...
 ERROR  ValidationError: webpack Dev Server Invalid Options

options.clientLogLevel should be {String} and equal to one of the allowed values

 [ 'info', 'warn', 'error', 'debug', 'trace', 'silent' ]

 (https://webpack.js.org/configuration/dev-server/#devserverclientloglevel)

ValidationError: webpack Dev Server Invalid Options

options.clientLogLevel should be {String} and equal to one of the allowed values

 [ 'info', 'warn', 'error', 'debug', 'trace', 'silent' ]

 (https://webpack.js.org/configuration/dev-server/#devserverclientloglevel)

    at validateOptions (C:\Users\Dell\Desktop\myapp\node_modules\webpack-dev-server\node_modules\schema-utils\src\validateOptions.js:32:11)
    at new Server (C:\Users\Dell\Desktop\myapp\node_modules\webpack-dev-server\lib\Server.js:71:5)
    at serve (C:\Users\Dell\Desktop\myapp\node_modules\@vue\cli-service\lib\commands\serve.js:138:20)
    at process._tickCallback (internal/process/next_tick.js:68:7)
    at Function.Module.runMain (internal/modules/cjs/loader.js:757: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] serve: `vue-cli-service serve`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] serve 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!     C:\Users\Dell\AppData\Roaming\npm-cache\_logs\2019-05-17T19_40_14_984Z-debug.log

I tried npm cache clean -f, reinstallation of VueJS, recreation of project but nothing worked :(

I expect my npm run serve work!

Upvotes: 24

Views: 20239

Answers (7)

Jamal Basha
Jamal Basha

Reputation: 498

Remove node_modules folder and npm install agani

rm -rf node_modules

Upvotes: 1

Yuta Hiroto
Yuta Hiroto

Reputation: 1

webpack-dev-server has been released as v3.4.1 for hotfix. Please update. https://github.com/webpack/webpack-dev-server/releases/tag/v3.4.1

Upvotes: 0

MorayJ
MorayJ

Reputation: 537

I edited

node_modules/@vue/cli-service/lib/commands/serve.js

so that line 139 says:

clientLogLevel: 'warn'

instead of

clientLogLevel: 'none'

(Edit - though I'm working with the hello-world app)

Upvotes: 0

John Datserakis
John Datserakis

Reputation: 960

yea this issue just popped up in the last few hours in @vue/cli. I had the same thing in a fresh project. To fix it try this:

  1. Create a file in the root of your project called vue.config.js if you don't already have that file.

  2. Add this to that file:

module.exports = {
  devServer: {
    clientLogLevel: 'info'
  }
};

Then re-run your project. Something happened last night where the clientLogLevel value that comes preset became incorrect.

Here's a thread talking about this issue: GitHub.

Upvotes: 16

urban_coder
urban_coder

Reputation: 1

The docs are a little confusing when using @vue/cli-service, since it essentially wraps webpack.

[Here is a link to the solution]( https://cli.vuejs.org/guide/webpack.html#simple-configuration)

Best thing to do is update your vue.config.js with something like

configureWebpack: {
    devServer: {
      clientLogLevel: `silent`,
    },
  },

Upvotes: 0

Philip Caleja
Philip Caleja

Reputation: 1

Seems like [email protected] broke something. I reverted it to 3.3.1 and it seems to be working.

Upvotes: 0

Dan
Dan

Reputation: 63059

I have no idea why you're getting that error but here is how you'd configure that option:

1. Create vue.config.js in your root directory

2. Enter the following into it:

module.exports = {
  devServer: {
    clientLogLevel: 'debug'
  }
}

3. Rerun npm run serve

You can read more about configuring the dev server here.

Upvotes: 5

Related Questions