ajv: NPM: 6.9.0 AJV Commit causing failure to execute node_modules (multiple dependencies affected i.e. ESLint and WebPack Loaders)
What version of Ajv are you using? Does the issue happen if you use the latest version?
Latest version (6.9.0 release I believe)
Ajv options object
node_modules/ajv/lib/keyword.js:65
throw new Error('custom keyword definition is invalid: ' + this.errorsText(validateDefinition.errors));
^
Error: custom keyword definition is invalid: data.errors should be boolean
at Ajv.addKeyword (/home/mmacheerpuppy/git/fsa/react-application/node_modules/ajv/lib/keyword.js:65:13)
at module.exports (/home/mmacheerpuppy/git/fsa/react-application/node_modules/ajv-errors/index.js:10:7)
at Object.<anonymous> (/home/mmacheerpuppy/git/fsa/react-application/node_modules/schema-utils/src/validateOptions.js:22:1)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
What results did you expect?
Expected to be able to build node_modules but experiencing above stacktrace.
Are you going to resolve the issue? Current workaround is to remove ESLint dependencies for NPM users, or if using YARN to resolve dependencies to forced version. It’s also possible (with the addition of another dependency) to use NPM resolutions (see conversation).
Reproduction
Try using the following packages declaration. npm post install will fail to start. ESLint relies on AJV.
{
"name": "food-standards",
"version": "0.1.0",
"private": true,
"dependencies": {
"axios": "^0.18.0",
"bootstrap": "^4.2.1",
"react": "^16.8.1",
"react-dom": "^16.8.1",
"react-scripts": "2.1.3",
"reactstrap": "^7.1.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
],
"devDependencies": {
"axios-mock-adapter": "^1.16.0",
"eslint": "5.6.0",
"eslint-config-airbnb": "^17.1.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-jsx-a11y": "^6.1.1",
"eslint-plugin-react": "^7.11.0",
"react-testing-library": "^5.5.3"
}
}
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 45
- Comments: 45 (6 by maintainers)
Commits related to this issue
- fix: Webpack broken by AJV update Lock the version of AJV for now, until issue is resolved https://github.com/webpack/webpack/issues/8768 https://github.com/epoberezkin/ajv/issues/941 — committed to thebuilder/react-intersection-observer by thebuilder 5 years ago
- fix: log instead of throw when definition validation fails fixes #941 — committed to fkleuver/ajv by fkleuver 5 years ago
- Added resolutions fix as suggested by https://github.com/epoberezkin/ajv/issues/941 to solve the issue of failed ci build. — committed to alidrus/vue-simple-inline-translation by alidrus 5 years ago
- chore(browserstack): pin ajv to 6.8.1 for now due to https://github.com/epoberezkin/ajv/issues/941 — committed to aurelia/aurelia by fkleuver 5 years ago
- chore(browserstack): pin ajv to 6.8.1 for now due to https://github.com/epoberezkin/ajv/issues/941 — committed to aurelia/aurelia by fkleuver 5 years ago
- Downgrade ajv (for now) https://github.com/epoberezkin/ajv/issues/941 — committed to supersonicclay/grok-groceries by supersonicclay 5 years ago
- Downgrade AJV (temp workaround) * See: https://github.com/epoberezkin/ajv/issues/941 * Trying to get fresh build since upgrading lodash * Check for updates on Monday — committed to KevinMarley/KevinMarley.github.io by vapurrmaid 5 years ago
- Avoid ajv@6.9.0 for now Because ajv@6.9.0 does not work with webpack. Ref: https://github.com/epoberezkin/ajv/issues/941 — committed to y-yagi/rails by y-yagi 5 years ago
- fix: incorrect custom keyword definition schema, #941 — committed to ajv-validator/ajv by epoberezkin 5 years ago
- Update package.json — committed to misskey-dev/misskey by acid-chicken 5 years ago
- fix: Webpack broken by AJV update Lock the version of AJV for now, until issue is resolved https://github.com/webpack/webpack/issues/8768 https://github.com/epoberezkin/ajv/issues/941 — committed to johnrackles/react-intersection-observer by thebuilder 5 years ago
Add
to your package.json will create a work around (I am using yarn, don’t know if it will work for npm)
This is certainly related to the latest changes made in the commit history.
released 6.9.1
@velocity-360 I’m trying to write a technical test for a job interview in React! 🤣
this worked for me using npm
workaround for yarn users: add
to your package.json and re run
yarn install
I fixed this issue by resorting to an old version that I knew worked. Ran this
npm install --save ajv@6.6.2
@gregoriB Yeah, I ran
npm i
after adding"ajv": "6.8.1"
to my package.json and it didn’t work.I tried again with
"ajv": "6.8.1"
in my package.json and ranrm -rf node_modules
,npm cache clean --force
, and thennpm i
and that did the trick. I’ve now got create-react app up and running.just add
to your package.json
if you use yarn: run
yarn install
if you use npm: https://github.com/rogeriochaves/npm-force-resolutions TL;DR
Can confirm for React users it’s ESLint and ESLint addons which are causing the issue in the dependency chain. Removing these and running
npm install && npm start
was sufficient to get me back on development.So if you’re in a hurry to get back on it, its time to get bare with React!
It probably is possible to make travis CI run tests of some dependencies against the new tags (e.g. webpack and eslint).
it is 3:30am london time, so a few more hours before @epoberezkin wakes up and releases a new version, time to go do something else for a bit!
looks like https://github.com/epoberezkin/ajv/issues/941#issuecomment-462087631 beat me to that 😅
Can confirm, this is happening for me too when scaffolding Vue JS projects. Currently on Vue CLI 3.4.0, Mac OS 10.13.4. Please fix soon as this is causing serious delays.