Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

throw new Error('invalid "instanceof" keyword value ' + c); #1355

Closed
john1jan opened this issue Mar 24, 2018 · 18 comments
Closed

throw new Error('invalid "instanceof" keyword value ' + c); #1355

john1jan opened this issue Mar 24, 2018 · 18 comments

Comments

@john1jan
Copy link

Getting this error while running
webpack-dev-server --config ./webpack.client.js --hot

  • Operating System: Mac OS High Sierra
  • Node Version: 9.9.0
  • NPM Version: 5.7.1
  • webpack Version: 4.1.1
  • webpack-dev-server Version:3.1.1
    Full stacktrace
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 (node_modules/webpack/node_modules/ajv-keywords/keywords/instanceof.js:52:11)
    at Ajv.compile (node_modules/webpack/node_modules/ajv-keywords/keywords/instanceof.js:21:27)
    at Object.useCustomRule (node_modules/webpack/node_modules/ajv/lib/compile/index.js:275:26)
    at Object.generate_custom [as code] (node_modules/webpack/node_modules/ajv/lib/dotjs/custom.js:32:24)
    at Object.generate_validate [as validate] (node_modules/webpack/node_modules/ajv/lib/dotjs/validate.js:347:35)
    at Object.generate_anyOf [as code] (node_modules/webpack/node_modules/ajv/lib/dotjs/anyOf.js:34:27)
    at generate_validate (node_modules/webpack/node_modules/ajv/lib/dotjs/validate.js:347:35)
    at localCompile (node_modules/webpack/node_modules/ajv/lib/compile/index.js:87:22)
    at Ajv.compile (node_modules/webpack/node_modules/ajv/lib/compile/index.js:56:13)
    at Ajv._compile (node_modules/webpack/node_modules/ajv/lib/ajv.js:358:27)
    at Ajv.compile (node_modules/webpack/node_modules/ajv/lib/ajv.js:118:37)
    at validateObject (node_modules/webpack/lib/validateSchema.js:36:23)
    at validateSchema (node_modules/webpack/lib/validateSchema.js:31:10)
    at processConfiguredOptions (node_modules/webpack-cli/bin/convert-argv.js:156:48)
    at module.exports (node_modules/webpack-cli/bin/convert-argv.js:150:10)
    at Object.<anonymous> (node_modules/webpack-dev-server/bin/webpack-dev-server.js:234:54)
@silky
Copy link

silky commented Mar 25, 2018

why do bad things happen to good people?

we manually hacked our package.json to use webpack 4.2.0 and this error goes away!

woo!

@DCbryant
Copy link

I solved by lowerring my webpack-dev-server version,The problem is there

@ndabAP
Copy link

ndabAP commented Apr 3, 2018

@DCbryant which version do you use now?

@DCbryant
Copy link

DCbryant commented Apr 3, 2018

@ndabAP 2.9.1

@styks1987
Copy link

styks1987 commented Apr 4, 2018

I had a similar issue but it was due to not having webpack-cli installed locally.

@rohan-paul
Copy link

Had this issue today, and went away, after upgrading webpack to 4.5.0 and also installing webpack-cli locally..

@zvs001
Copy link

zvs001 commented Apr 9, 2018

npm i webpack@latest -g helps me

@MgSam
Copy link

MgSam commented Apr 12, 2018

So this happened because webpack pushed breaking changes in a minor version and most people probably have their package.json file with a carrot or tilde in front of the webpack dependencies. Removing that carrot or tilde to freeze to the version specified and running npm install fixed the problem for me.

I think it's extremely irresponsible for webpack to have made these breaking changes in a minor version. The webpack CLI separation should have only occurred in a major release. You have literally millions of people depending on this package, please put some more thought into release numbers.

@kopax
Copy link

kopax commented Apr 13, 2018

I have this error in a lerna project when I try to install in two different package it then fail to find the module webpack-cli:

$ ./node_modules/.bin/webpack-dev-server --progress --color --hot --watch --mode development
The CLI moved into a separate package: webpack-cli.
Please install 'webpack-cli' in addition to webpack itself to use the CLI.
-> When using npm: npm install webpack-cli -D
-> When using yarn: yarn add webpack-cli -D
module.js:559
    throw err;
    ^

Error: Cannot find module 'webpack-cli/bin/config-yargs'
    at Function.Module._resolveFilename (module.js:557:15)
    at Function.Module._load (module.js:484:25)
    at Module.require (module.js:606:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/home/dka/workspace/github.com/yeutech/react-admin/node_modules/webpack-dev-server/bin/webpack-dev-server.js:65:1)
    at Module._compile (module.js:662:30)
    at Object.Module._extensions..js (module.js:673:10)
    at Module.load (module.js:575:32)
    at tryModuleLoad (module.js:515:12)
    at Function.Module._load (module.js:507:3)
error An unexpected error occurred: "Command failed.

so I moved it to the top package.json, and then I have this error:

yarn run v1.5.1
$ ./node_modules/.bin/webpack-dev-server --progress --color --hot --watch --mode development
/home/dka/workspace/github.com/yeutech/react-admin/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 (/home/dka/workspace/github.com/yeutech/react-admin/node_modules/webpack/node_modules/ajv-keywords/keywords/instanceof.js:52:11)
    at Ajv.compile (/home/dka/workspace/github.com/yeutech/react-admin/node_modules/webpack/node_modules/ajv-keywords/keywords/instanceof.js:21:27)
    at Object.useCustomRule (/home/dka/workspace/github.com/yeutech/react-admin/node_modules/ajv/lib/compile/index.js:275:26)
    at Object.generate_custom [as code] (/home/dka/workspace/github.com/yeutech/react-admin/node_modules/ajv/lib/dotjs/custom.js:32:24)
    at Object.generate_validate [as validate] (/home/dka/workspace/github.com/yeutech/react-admin/node_modules/ajv/lib/dotjs/validate.js:347:35)
    at Object.generate_anyOf [as code] (/home/dka/workspace/github.com/yeutech/react-admin/node_modules/ajv/lib/dotjs/anyOf.js:34:27)
    at generate_validate (/home/dka/workspace/github.com/yeutech/react-admin/node_modules/ajv/lib/dotjs/validate.js:347:35)
    at localCompile (/home/dka/workspace/github.com/yeutech/react-admin/node_modules/ajv/lib/compile/index.js:87:22)
    at Ajv.compile (/home/dka/workspace/github.com/yeutech/react-admin/node_modules/ajv/lib/compile/index.js:56:13)
    at Ajv._compile (/home/dka/workspace/github.com/yeutech/react-admin/node_modules/ajv/lib/ajv.js:358:27)
error An unexpected error occurred: "Command failed.
Exit code: 1

I have tried to downgrade webpack from 4.5.0 to 4.2.0 as @silky recommend but that doesn't help.

Any idea on how to solve this?

@GQM-dong
Copy link

maybe you can change your package.json
update the webpack to 4.X
delete your node_modules
npm install again
and then it's work

@BrandonDickson
Copy link

BrandonDickson commented Apr 19, 2018

@kopax, I was able to solve this by updating lerna to 2.10.0 from 2.0.0-rc5, and updating webpack in all my package.json files. I believe the problem stemmed from the fact that I was updating webpack one project at a time, and I was hoisting the modules with lerna, but the updates resolved it.

@SpaceK33z
Copy link
Member

It looks like this issue is related to webpack and/or webpack-cli, not webpack-dev-server, so I'm closing this. If you believe this is an issue in WDS please provide a test repository, because I cannot reproduce this.

@HamidOsouli-zz
Copy link

remember to lower your webpack-dev-server globaly not localy use :
npm install webpack-dev-server@2.9.1 -g --save-dev and after that you are set

@kunwang0916
Copy link

npm install webpack-dev-server@2.x, works for me.

@realgs
Copy link

realgs commented Jan 11, 2019

I read this topic for a second time within 2 weeks so I decided to write down my own suggestions in case I will come back anytime in the future;) The below is a complete list of dependencies I had to upgrade to upgrade from vulnerable react-dom@16.0.0 to @16.0.1:

❯ yarn add react@16.0.1 react-dom@16.0.1 webpack-dev-server@3.1.14 live-server@1.2.1 extract-text-webpack-plugin@next
❯ yarn add -D webpack-cli

remove node_modules
npm install
add --mode development to your CLI command (webpack-dev-server --mode development)
try again to start the project with yarn run dev-server (or whatever is your script to run the project locally)

@AbuAmeeer
Copy link

you can use npm run build instead of

@imzubair10
Copy link

following worked for me
npm install webpack-dev-server@2.11.0 --save-dev

@rramiachraf
Copy link

following worked for me
npm install webpack-dev-server@2.11.0 --save-dev

Thank you, this is actually worked..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests