Webpack-dev-server: Error: Invalid "instanceof" keyword

Created on 20 Apr 2018  路  5Comments  路  Source: webpack/webpack-dev-server

  • Operating System:
  • Node Version: 9.11.1
  • NPM Version: 5.6.0
  • webpack Version: 3.4.1
  • webpack-dev-server Version: 3.1.3
  • [x] This is a bug
  • [ ] This is a modification request
D:\boiler\bs-wp\node_modules\webpack\node_modules\ajv-keywords\keywords\instanceof.js:52
    throw new Error('invalid "instanceof" keyword value
' + c);
    ^

Error: invalid "instanceof" keyword value Promise
    at getConstructor (D:\boiler\bs-wp\node_modules\webpack\node_modules\ajv-keywords\keywords\instanceof.js:52:11)
    at Ajv.compile (D:\boiler\bs-wp\node_modules\webpack\node_modules\ajv-keywords\keywords\instanceof.js:21:27)    at Object.useCustomRule (D:\boiler\bs-wp\node_modules\webpack\node_modules\ajv\lib\compile\index.js:275:26)
    at Object.generate_custom [as code] (D:\boiler\bs-wp\node_modules\webpack\node_modules\ajv\lib\dotjs\custom.js:32:24)
    at Object.generate_validate [as validate] (D:\boiler\bs-wp\node_modules\webpack\node_modules\ajv\lib\dotjs\validate.js:347:35)
    at Object.generate_anyOf [as code] (D:\boiler\bs-wp\node_modules\webpack\node_modules\ajv\lib\dotjs\anyOf.js:34:27)
    at generate_validate (D:\boiler\bs-wp\node_modules\webpack\node_modules\ajv\lib\dotjs\validate.js:347:35)
    at localCompile (D:\boiler\bs-wp\node_modules\webpack\node_modules\ajv\lib\compile\index.js:87:22)
    at Ajv.compile (D:\boiler\bs-wp\node_modules\webpack\node_modules\ajv\lib\compile\index.js:56:13)
    at Ajv._compile (D:\boiler\bs-wp\node_modules\webpack\node_modules\ajv\lib\ajv.js:358:27)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `webpack-dev-server --open`
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!     C:\Users\Dell\AppData\Roaming\npm-cache\_logs\2018-04-20T13_26_09_341Z-debug.log

const path = require('path');

const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const CleanPlugin = require('clean-webpack-plugin');
const webpack = require('webpack');

module.exports = {
    entry: './src/app.js',
    devtool: 'inline-source-map',
    devServer: {
        contentBase: './dist',
        hot: true
    },
    module: {
        rules: [
            {
                test: /\.scss$/,
                use: ExtractTextPlugin.extract({
                    fallback: 'style-loader',
                    use: ['css-loader', 'sass-loader']
                })
            }
        ]
    },
    plugins: [
        new CleanPlugin(['dist']),
        new HtmlWebpackPlugin({
            title: 'Regenerating HTML',
            template: './src/index.ejs'
        }),
        new ExtractTextPlugin({
            filename: 'app.bundle.css',
            disable: false,
            allChunks: true
        })
    ],
    output: {
        filename: 'app.bundle.js',
        path: path.resolve(__dirname, 'dist')
    },
}
  // additional code, remove if not needed.

Expected Behavior

Dev Server

Actual Behavior

For Bugs; How can we reproduce the behavior?

For Features; What is the motivation and/or use-case for the feature?

Most helpful comment

After updating webpack, webpack-cli and webpack-dev-server... error is gone! =)

All 5 comments

Please try to upgrade to the latest webpack and webpack-cli versions.

strange, I was using the latest version then downgrade the webpack version, it was not working, now I again upgrade it, now have new error "Chunk.entrypoints: Use Chunks.groupsIterable and filter by instanceof Entrypoint"
capture

Please update you deps, also you can install webpack or webpack-dev-server globally, please update their too and also please double check your lock file (if you use). Thanks!

After updating webpack, webpack-cli and webpack-dev-server... error is gone! =)

Getting error like this when running webpack in typescript project

invalid "instanceof" keyword value Promise

Was this page helpful?
0 / 5 - 0 ratings