I just created a new React application using this command:
create-react-app mysite.com
After installation, when I tried to open it using npm start
and yarn start
, I got the following error.
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 (/Users/myAccount/Documents/Dev/Projects/ReactJS/mysite.com/node_modules/ajv/lib/keyword.js:65:13)
How can I fix this problem?
Reverting to a stable version of the ajv library also works:
npm uninstall ajv
npm install ajv@6.8.1
I thought that was something new coming with "@symfony/webpack-encore": "^0.23.0". However, there's an issue with the ajv
library.
Dirty fix:
In
node_modules\ajv-errors\index.js
change the errors:
parameter at line 14 from 'full'
to true
.
Clean fix (temporary):
Modify your package.json using this:
"resolutions": {
"ajv": "6.8.1"
}
Comment out node_modules/ajv/lib/keyword.js
at line 64-65 for a workaround solution:
if (!validateDefinition(definition))
throw new Error('custom keyword definition is invalid: ' + this.errorsText(validateDefinition.errors));
Ref: https://github.com/webpack/webpack/issues/8768
I get this error when I try and make a new nuxt application with npx:
npx create-nuxt-app <project-name>
I did
npm uninstall ajv
npm install ajv@6.8.1
Like @robert Rodriguez, it works, no errors.