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

webpack broken by ajv@6.9.0, "custom keyword definition is invalid: data.errors should be boolean" #8768

Closed
sky-coding opened this issue Feb 9, 2019 · 75 comments

Comments

@sky-coding
Copy link

Bug report

What is the current behavior?
A fresh install of webpack will fail to run with the error "custom keyword definition is invalid: data.errors should be boolean" due to the latest version of ajv. See issue here ajv-validator/ajv#941 referencing many other broken projects.

If the current behavior is a bug, please provide the steps to reproduce.
Install webpack and attempt to use it.

What is the expected behavior?
I expect webpack not to fail due to unreliable, auto-updating dependencies.

Other relevant information:
webpack version: 4.28.4
Node.js version: 10.15.1
Operating System: Windows 10
Additional tools:

@joacub
Copy link

joacub commented Feb 9, 2019

same here

@ivangajic
Copy link

Same

@RusseII
Copy link

RusseII commented Feb 9, 2019

If you use yarn

add below to package.json

  "resolutions": {
    "ajv": "6.8.1"
  }

then run yarn install

if you use npm

npm uninstall ajv
npm install ajv@6.8.1

@diegowifi
Copy link

Same issue, just happened after doing a npm install

@lucasfarias2
Copy link

same, thanks for posting, this might be something new

@kmeraz
Copy link

kmeraz commented Feb 9, 2019

😢 🚑

@ivangajic
Copy link

Quick fix, in node_modules\ajv\lib\keyword.js I commented out
if (!validateDefinition(definition))
throw new Error('custom keyword definition is invalid: ' + this.errorsText(validateDefinition.errors));
and it works, still waiting for fix

thebuilder added a commit to thebuilder/react-intersection-observer that referenced this issue Feb 9, 2019
Lock the version of AJV for now, until issue is resolved
webpack/webpack#8768
ajv-validator/ajv#941
@diegowifi
Copy link

@ivangajic yes, that does the trick for now 👍

@acro5piano
Copy link

acro5piano commented Feb 9, 2019

I've created a minimal reproduction repository: https://github.com/acro5piano/webpack-issues-8768

@JesusViveros12
Copy link

@ivangajic, what's the line in the file? i don't found 😢 I have the same issue with my angular 7 project

@ivangajic
Copy link

@ivangajic, what's the line in the file? i don't found 😢 I have the same issue with my angular 7 project

That's 64 and 65

@mkowalczyk111
Copy link

@JesusViveros12
node_modules/ajv/lib/keyword.js
64 and 65

@tyteen4a03
Copy link

tyteen4a03 commented Feb 9, 2019

Or add this to your package.json:

  "resolutions": {
    "ajv": "6.8.1"
  }

Then yarn install.

For npm users:

rm -rf node_modules
npx npm-force-resolutions
npm install

@youngzaphod
Copy link

Or add this to your package.json:

  "resolutions": {
    "ajv": "6.8.1"
  }

Seems so simple I would love it to work, but getting same error, anything else I should look at?

@acro5piano
Copy link

acro5piano commented Feb 10, 2019

@tyteen4a03 Thanks, it works for me!

@JesusViveros12
Copy link

@ivangajic , i have different code in these lines:

image

I'll try with the @tyteen4a03 solution too

@mkowalczyk111
Copy link

Or add this to your package.json:

  "resolutions": {
    "ajv": "6.8.1"
  }

Seems so simple I would love it to work, but getting same error, anything else I should look at?

Have you reinstalled your packages with npm install? ;p

@ivangajic
Copy link

@JesusViveros12
Should be somewhere at the beginning of the addKeyword function, if not, maybe you're using different version

@jackturnbull
Copy link

jackturnbull commented Feb 10, 2019

Note that resolutions is a yarn feature and not an npm feature. From the linked ajv issue:

just add

  "resolutions": {
    "ajv": "6.8.1"
  }

to your package.json

if you use yarn:
run yarn install

if you use npm:
https://github.com/rogeriochaves/npm-force-resolutions TL;DR

rm -rf node_modules
npx npm-force-resolutions
npm install

@arielwolffe
Copy link

Or add this to your package.json:

  "resolutions": {
    "ajv": "6.8.1"
  }

Seems so simple I would love it to work, but getting same error, anything else I should look at?

Have you reinstalled your packages with npm install? ;p

I did, didn't seem to fix it for me either.

@tyteen4a03
Copy link

@jackturnbull Thanks - I was just about to clarify.

@youngzaphod
Copy link

npm

Or add this to your package.json:

  "resolutions": {
    "ajv": "6.8.1"
  }

Seems so simple I would love it to work, but getting same error, anything else I should look at?

Have you reinstalled your packages with npm install? ;p

I did, didn't seem to fix it for me either.

Didn't at first, but just did an no luck. I'm looking in the package-lock.json file and seeing it still has the code below, would that make a difference? New to all this.

"ajv": { "version": "6.9.0", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.9.0.tgz", "integrity": "sha512-VsK2jpqRno3Hn+at4NGtBRpR5q3OW7n5INrTKqENDNQJB99DXATQEVHlnoD1BA7Uo/qGO+ijGA/vgSAlxP9E4A==", "requires": { "fast-deep-equal": "^2.0.1", "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" } },

@tyteen4a03
Copy link

@youngzaphod Please see updated comment for npm (or switch to Yarn)

@leefernandes
Copy link

leefernandes commented Feb 10, 2019

updating package-lock.json definitions worked on my end, there were many referencing 6.9.0 and I clobbered them all back to 6.8.1 as below.

"ajv": {
	"version": "6.8.1",
	"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.8.1.tgz",
	"integrity": "sha512-eqxCp82P+JfqL683wwsL73XmFs1eG6qjw+RD3YHx+Jll1r0jNd4dh8QG9NYAeNGA/hnZjeEDgtTskgJULbxpWQ==",
	"requires": {
		"fast-deep-equal": "^2.0.1",
		"fast-json-stable-stringify": "^2.0.0",
		"json-schema-traverse": "^0.4.1",
		"uri-js": "^4.2.2"
	}
},

https://stackoverflow.com/a/48524488

@amertoukan
Copy link

Quick fix, in node_modules\ajv\lib\keyword.js I commented out
if (!validateDefinition(definition))
throw new Error('custom keyword definition is invalid: ' + this.errorsText(validateDefinition.errors));
and it works, still waiting for fix

This worked with me

@Sergej-Popov
Copy link

Sergej-Popov commented Feb 10, 2019

Another option is to lockdown to 4.28.x the webpack itself

"webpack": "~4.28.0"

@DarkLink363
Copy link

DarkLink363 commented Feb 10, 2019

To fix this error, just change:
Line 14: errors: 'full',
to:
Line 14: errors: true
in file node_modules\ajv-errors\index.js

@lenoraporter
Copy link

"resolutions": {
"ajv": "6.8.1"
}

with yarn install worked for me.

@ivangajic
Copy link

@DarkLink363
Works :)

@hamzaBentahar
Copy link

What worked for me is to comment the line that throws the error in : node_modules\ajv\lib\keyword.js
thank you ivangajic

@hiroppy
Copy link
Member

hiroppy commented Feb 10, 2019

It is fixed so let's wait a little more:)
ajv-validator/ajv#943

@yangchongduo
Copy link

Awesome

@arkhamRejek
Copy link

if it's not working for you after the resolutions addition to your packages, delete node modules before running the install and it should work.

@fkleuver
Copy link

@hiroppy The question is, when will the owner of the project be online again. I have a feeling he published right before going to bed, so it may take a few more hours at least before he's around and notices my PR :-) (and then the question is will he like the solution or not)

@tgrlbyrk
Copy link

If you use yarn

add below to package.json

  "resolutions": {
    "ajv": "6.8.1"
  }

then run yarn install

if you use npm

npm uninstall ajv
npm install ajv@6.8.1

it took my 2 hours... you saved me!

@Gabrielfcs
Copy link

npm uninstall ajv
npm install ajv@6.8.1

Thanks, it works for me!

@jsbroks
Copy link

jsbroks commented Feb 10, 2019

npm uninstall ajv
npm install ajv@6.8.1

When using this method it set ajv to ^6.8.1 for me, make sure it is just 6.8.1.

summerliu added a commit to summerliu/weather-app that referenced this issue Feb 10, 2019
philipbelesky added a commit to TabbycatDebate/tabbycat that referenced this issue Feb 10, 2019
As per webpack/webpack#8768
Note that you may need to nuke your node_modules folder and reinstall
@jmrmgn
Copy link

jmrmgn commented Feb 10, 2019

image

Thanks for sharing. This will do the trick!

@ArchambaultP
Copy link

Hey, so I'm having trouble with this using docker-compose. any tips ?

@paichunwang
Copy link

paichunwang commented Feb 10, 2019

Was looking in the wrong folder, thanks for the tips on quick fix.

@maisonm
Copy link

maisonm commented Feb 10, 2019

If you use yarn

add below to package.json

  "resolutions": {
    "ajv": "6.8.1"
  }

then run yarn install

if you use npm

npm uninstall ajv
npm install ajv@6.8.1

This worked for me.

@jsbroks
Copy link

jsbroks commented Feb 10, 2019

@ArchambaultP
add

RUN npm uninstall ajv
RUN npm install ajv@6.8.1

to the dockerfile

@TheLarkInn
Copy link
Member

TheLarkInn commented Feb 10, 2019

Hey everyone thanks for all the quick feedback. We will reach out to AJV and see if we can tighten up the communication channels for their API and will consider pinning this dep for the future. I will lock the thread once I get off mobile (bad winter storm here right now and losing power intermittently 😂🥶) since there are quite a few workarounds posted!

@webpack webpack locked as resolved and limited conversation to collaborators Feb 10, 2019
@TheLarkInn
Copy link
Member

Note that I just locked it as "resolved" not because the issue is fixed, but because we are aware of the issue and there are workarounds posted above. <3 Thanks for the patience and understanding everyone.

acid-chicken referenced this issue in misskey-dev/misskey Feb 10, 2019
@sokra
Copy link
Member

sokra commented Feb 10, 2019

Fixed

@sokra sokra closed this as completed Feb 10, 2019
@TheLarkInn
Copy link
Member

TY @sokra was just checking on it ❤️

johnrackles pushed a commit to johnrackles/react-intersection-observer that referenced this issue Feb 19, 2020
Lock the version of AJV for now, until issue is resolved
webpack/webpack#8768
ajv-validator/ajv#941
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests