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

Projects
None yet
@sky-coding
Copy link

sky-coding commented Feb 9, 2019

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 epoberezkin/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

This comment has been minimized.

Copy link

joacub commented Feb 9, 2019

same here

@ivangajic

This comment has been minimized.

Copy link

ivangajic commented Feb 9, 2019

Same

@RusseII

This comment has been minimized.

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

This comment has been minimized.

Copy link

diegowifi commented Feb 9, 2019

Same issue, just happened after doing a npm install

@lucasfarias2

This comment has been minimized.

Copy link

lucasfarias2 commented Feb 9, 2019

same, thanks for posting, this might be something new

@kmeraz

This comment has been minimized.

Copy link

kmeraz commented Feb 9, 2019

😢 🚑

@ivangajic

This comment has been minimized.

Copy link

ivangajic commented Feb 9, 2019

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

fix: Webpack broken by AJV update
Lock the version of AJV for now, until issue is resolved
webpack/webpack#8768
epoberezkin/ajv#941
@diegowifi

This comment has been minimized.

Copy link

diegowifi commented Feb 9, 2019

@ivangajic yes, that does the trick for now 👍

@acro5piano

This comment has been minimized.

Copy link

acro5piano commented Feb 9, 2019

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

@JesusViveros12

This comment has been minimized.

Copy link

JesusViveros12 commented Feb 9, 2019

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

@ivangajic

This comment has been minimized.

Copy link

ivangajic commented Feb 9, 2019

@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

@devx97

This comment has been minimized.

Copy link

devx97 commented Feb 9, 2019

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

@tyteen4a03

This comment has been minimized.

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

This comment has been minimized.

Copy link

youngzaphod commented Feb 10, 2019

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

This comment has been minimized.

Copy link

acro5piano commented Feb 10, 2019

@tyteen4a03 Thanks, it works for me!

@JesusViveros12

This comment has been minimized.

Copy link

JesusViveros12 commented Feb 10, 2019

@ivangajic , i have different code in these lines:

image

I'll try with the @tyteen4a03 solution too

@devx97

This comment has been minimized.

Copy link

devx97 commented Feb 10, 2019

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

This comment has been minimized.

Copy link

ivangajic commented Feb 10, 2019

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

@jackturnbull

This comment has been minimized.

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

This comment has been minimized.

Copy link

arielwolffe commented Feb 10, 2019

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

This comment has been minimized.

Copy link

tyteen4a03 commented Feb 10, 2019

@jackturnbull Thanks - I was just about to clarify.

@youngzaphod

This comment has been minimized.

Copy link

youngzaphod commented Feb 10, 2019

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

This comment has been minimized.

Copy link

tyteen4a03 commented Feb 10, 2019

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

@ItsLeeOwen

This comment has been minimized.

Copy link

ItsLeeOwen 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

This comment has been minimized.

Copy link

amertoukan commented Feb 10, 2019

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

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

Copy link

lenoraporter commented Feb 10, 2019

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

with yarn install worked for me.

@ivangajic

This comment has been minimized.

Copy link

ivangajic commented Feb 10, 2019

@DarkLink363
Works :)

@bellcc

This comment has been minimized.

Copy link

bellcc commented Feb 10, 2019

Worked for me,
npm uninstall ajv
npm install ajv@6.8.1

Worked like a charm!

@hamzaBentahar

This comment has been minimized.

Copy link

hamzaBentahar commented Feb 10, 2019

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

y-yagi added a commit to y-yagi/rails that referenced this issue Feb 10, 2019

Avoid ajv@6.9.0 for now
Because ajv@6.9.0 does not work with webpack.
Ref: webpack/webpack#8768
@hiroppy

This comment has been minimized.

Copy link
Contributor

hiroppy commented Feb 10, 2019

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

@yangchongduo

This comment has been minimized.

Copy link

yangchongduo commented Feb 10, 2019

Awesome

@arkhamRejek

This comment has been minimized.

Copy link

arkhamRejek commented Feb 10, 2019

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

This comment has been minimized.

Copy link

fkleuver commented Feb 10, 2019

@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

This comment has been minimized.

Copy link

tgrlbyrk 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

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

@Gabrielfcs

This comment has been minimized.

Copy link

Gabrielfcs commented Feb 10, 2019

npm uninstall ajv
npm install ajv@6.8.1

Thanks, it works for me!

@jsbroks

This comment has been minimized.

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.

chittyliu added a commit to chittyliu/weather-app that referenced this issue Feb 10, 2019

philipbelesky added a commit to TabbycatDebate/tabbycat that referenced this issue Feb 10, 2019

Fix webpack dependency issue
As per webpack/webpack#8768
Note that you may need to nuke your node_modules folder and reinstall
@meep26

This comment has been minimized.

Copy link

meep26 commented Feb 10, 2019

image

Thanks for sharing. This will do the trick!

@ArchambaultP

This comment has been minimized.

Copy link

ArchambaultP commented Feb 10, 2019

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

@paichunwang

This comment has been minimized.

Copy link

paichunwang commented Feb 10, 2019

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

@maisonm

This comment has been minimized.

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

This comment has been minimized.

Copy link

jsbroks commented Feb 10, 2019

@ArchambaultP
add

RUN npm uninstall ajv
RUN npm install ajv@6.8.1

to the dockerfile

@TheLarkInn

This comment has been minimized.

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

This comment has been minimized.

Copy link
Member

TheLarkInn commented Feb 10, 2019

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 syuilo/misskey Feb 10, 2019

@sokra

This comment has been minimized.

Copy link
Member

sokra commented Feb 10, 2019

Fixed

@sokra sokra closed this Feb 10, 2019

@TheLarkInn

This comment has been minimized.

Copy link
Member

TheLarkInn commented Feb 10, 2019

TY @sokra was just checking on it ❤️

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.