Webpack-dev-server: v2.3.0 - devServer.colors option not working

Created on 5 Feb 2017  路  6Comments  路  Source: webpack/webpack-dev-server

package.json devDependencies
"webpack": "^2.1.0-beta.25",
"webpack-dev-server": "^2.1.0-beta.0",

i checked the package.json present in node_modules/webpack-dev-server folder it shows 2.3.0 which is the latest release according to npm.

webpack devServer config

devServer: {
    hot: true,
    progress: true,
    colors: true,
    host: devServerSettings.FLASH_DEV_SERVER_HOST,
    port: devServerSettings.FLASH_DEV_SERVER_PORT,
},

ERROR:

Invalid configuration object. webpack-dev-server has been initialised using a configuration object that does not match the API schema.
 - configuration has an unknown property 'colors'. These properties are valid:
   object { hot?, hotOnly?, lazy?, host?, filename?, publicPath?, port?, socket?, watchOptions?, headers?, clientLogLevel?, overlay?, key?, cert?, ca?, pfx?, pfxPassphrase?, inline?, public?, https?, contentBase?, watchContentBase?, open?, features?, compress?, proxy?, historyApiFallback?, staticOptions?, setup?, stats?, reporter?, noInfo?, quiet?, serverSideRender?, index?, log?, warn? }

npm ERR! Linux 3.19.0-68-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "dev"
npm ERR! node v5.0.0
npm ERR! npm  v3.3.12
npm ERR! code ELIFECYCLE
npm ERR! [email protected] dev: `webpack-dev-server --config /home/avinash/code/flash/webpack.devoffice.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] dev script 'webpack-dev-server --config /home/avinash/code/flash/webpack.devoffice.config.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the belong package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     webpack-dev-server --config /home/avinash/code/flash/webpack.devoffice.config.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls belong
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/avinash/code/flash/npm-debug.log

i checked the node_modules/webpack-dev-server/bin/webpack-dev-server.js source
it does have the following code

"color": {
    type: "boolean",
    alias: "colors",
    default: function supportsColor() {
        return require("supports-color");
    },
    group: DISPLAY_GROUP,
    describe: "Enables/Disables colors on the console"
},

while searching for solutions I came across this issue https://github.com/webpack/webpack-dev-server/issues/609 which was a missing devServer.progress issue
is similar fix needed for devServer.colors?

question

Most helpful comment

Thanks for your clear bugreport! Whether your terminal has color support is now calculated automatically, so you could remove that property from your config. If you want to force it, you can pass --color (or --no-color). Another options is to add stats: { colors: true } in devServer, but that shouldn't be necessary.

This was not part of any changelog (AFAIK), sorry!

All 6 comments

Thanks for your clear bugreport! Whether your terminal has color support is now calculated automatically, so you could remove that property from your config. If you want to force it, you can pass --color (or --no-color). Another options is to add stats: { colors: true } in devServer, but that shouldn't be necessary.

This was not part of any changelog (AFAIK), sorry!

@SpaceK33z i had to remove both the colors and progress from the devServer config to make devServer to have no errors.
but after removing them i don't see any colors in the stats section. when i was using webpack@v1 i used to get a typically green, yellow colorful stats.

as you can see in the error message both progress & colors are missing in the list of supported options. I just dont get why they are not listed but relevant source is in webpack-dev-server.js

Do you feel i need to provide more info or want me to check any misconfiguration or package version inconsistencies

Okay, I'll look into this soon.

The progress option not working via devServer is probably because I followed webpack with that, which also doesn't seem to list it anymore. I wanna keep it that way till I figure out why it is that way in webpack.

About the colors option, it's really weird that it doesn't correctly detect your terminal supporting colors. What exit code do you get when you run supports-color-cli? If that program exits with 0 (color is supported), could it be that you are overriding the stats option? If you want to force it you could add stats: { colors: true } in your devServer.

@sagiavinash Can you respond to Kees' questions so we can proceed with the issue?

Pruning due to age.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

subblue picture subblue  路  3Comments

da2018 picture da2018  路  3Comments

Jack-Works picture Jack-Works  路  3Comments

hnqlvs picture hnqlvs  路  3Comments

mischkl picture mischkl  路  3Comments