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

NPM: 6.9.0 AJV Commit causing failure to execute node_modules (multiple dependencies affected i.e. ESLint and WebPack Loaders) #941

Closed
caldempsey opened this issue Feb 9, 2019 · 45 comments
Labels

Comments

@caldempsey
Copy link

caldempsey commented Feb 9, 2019

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"
  }
}
@yooouuri
Copy link

yooouuri commented Feb 9, 2019

Same error for me #942 here using vue.js

@caldempsey
Copy link
Author

Is there a workaround to use an earlier release?

@yooouuri
Copy link

yooouuri commented Feb 9, 2019

I hope it get noticed fast

@tetreault
Copy link

tetreault commented Feb 9, 2019

Using nuxt for vue. My solve is doing npm i -d ajv@5.0.0 and i can run npm run dev again. This was a fresh nuxt project I started.

@caldempsey caldempsey changed the title Latest AJV Push causing failure to build node modules in React Latest AJV Push causing failure to build node_modules (multiple dependencies and users affected) Feb 9, 2019
@caldempsey
Copy link
Author

This is certainly related to the latest changes made in the commit history.

@yooouuri
Copy link

yooouuri commented Feb 9, 2019

Add

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

to your package.json will create a work around (I am using yarn, don't know if it will work for npm)

@mcrawshaw
Copy link

@epoberezkin can we roll back?

@caldempsey caldempsey changed the title Latest AJV Push causing failure to build node_modules (multiple dependencies and users affected) NPM: Latest AJV Push causing failure to build node_modules (multiple dependencies and users affected) Feb 9, 2019
@caldempsey caldempsey changed the title NPM: Latest AJV Push causing failure to build node_modules (multiple dependencies and users affected) NPM: Latest AJV Push causing failure to execute node_modules (multiple dependencies and users affected) Feb 9, 2019
@velocity-360
Copy link

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.

@yooouuri
Copy link

yooouuri commented Feb 9, 2019

@velocity-360 see my comment, use the work around! 😄

@csvan
Copy link

csvan commented Feb 9, 2019

Seeing the same thing when using latest storybook 4.1, reproducible by simply running the bin build-storybook included in the same package. This entirely breaks a very large ecosystem.

Error: custom keyword definition is invalid: data/errors should be boolean
    at Ajv.addKeyword (/home/csvan/IdeaProjects/pros-ui-components/module/node_modules/ajv/lib/keyword.js:66:13)
    at module.exports (/home/csvan/IdeaProjects/pros-ui-components/module/node_modules/ajv-errors/index.js:10:7)
    at Object.<anonymous> (/home/csvan/IdeaProjects/pros-ui-components/module/node_modules/schema-utils/src/validateOptions.js:22:1)
    at Module._compile (internal/modules/cjs/loader.js:734:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:745:10)
    at Module.load (internal/modules/cjs/loader.js:626:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:566:12)
    at Function.Module._load (internal/modules/cjs/loader.js:558:3)
    at Module.require (internal/modules/cjs/loader.js:663:17)
    at require (internal/modules/cjs/helpers.js:20:18)

@velocity-360
Copy link

@velocity-360 see my comment, use the work around! 😄

@yooouuri thank you however, I am currently contracted to create a Vue tutorial series for a large educational software company and do not think it would be wise to kick off the series with a work-around immediately on the first step. I will wait for resolution.

@yooouuri
Copy link

yooouuri commented Feb 9, 2019

@velocity-360 makes sense

@caldempsey
Copy link
Author

caldempsey commented Feb 9, 2019

@velocity-360 I'm trying to write a technical test for a job interview in React! 🤣

@richard-karp
Copy link

lol @mmacheerpuppy exact same situation for me

@caldempsey
Copy link
Author

caldempsey commented Feb 9, 2019

@RickyTony I spent some time debugging and it seems like latest AJV is a dependency for ESLint which may produce a collision. You can use npm ls ajv to check this out.

@viankakrisna
Copy link

workaround for yarn users:
add

  "resolutions": {
    "ajv": "6.5.5"
  }

to your package.json and re run yarn install

@viankakrisna
Copy link

looks like #941 (comment) beat me to that 😅

@richard-karp
Copy link

@mmacheerpuppy I kinda ran out of time for the day debugging, so hopefully it's fixed when I get back to it tomorrow

@gregoriB
Copy link

gregoriB commented Feb 9, 2019

  "dependencies": {
    "react": "^16.8.1",
    "react-dom": "^16.8.1",
    "react-scripts": "2.1.3",
    "ajv": "6.8.1"
  }

this worked for me using npm

@andrewtet
Copy link

@gregoriB I'm using create-react-app and unfortunately, I'm still getting the error after adding that 😞

@caldempsey
Copy link
Author

caldempsey commented Feb 9, 2019

@sky-coding You say that as if we don't have dependency chains on the back-end! @andrewtet can you kindly show your package.json?

@gregoriB
Copy link

gregoriB commented Feb 9, 2019

@andrewtet did you run npm install afterwards?

@viankakrisna
Copy link

i think npm users can use this workaround https://github.com/rogeriochaves/npm-force-resolutions

supersonicclay added a commit to supersonicclay/grok-groceries that referenced this issue Feb 10, 2019
greyscaled pushed a commit to KevinMarley/KevinMarley.github.io that referenced this issue Feb 10, 2019
* See: ajv-validator/ajv#941

* Trying to get fresh build since upgrading lodash

* Check for updates on Monday
@TheLarkInn
Copy link

Hey @epoberezkin we have reported upstream workaround in our linked issue webpack/webpack#8768 so hopefully this reduces the chatter while this is being tackled by your team or other AJV contributors.

If there is anything we can do to help, let us know. - webpack team

y-yagi added a commit to y-yagi/rails that referenced this issue Feb 10, 2019
Because ajv@6.9.0 does not work with webpack.
Ref: ajv-validator/ajv#941
@epoberezkin
Copy link
Member

Thanks for the patience, going to fix 7079aed - I think I know what the issue is.

errors can also be "full"...

@epoberezkin
Copy link
Member

released 6.9.1

@cenfun
Copy link

cenfun commented Feb 10, 2019

released 6.9.1

thanks, just test with ajv@6.9.1 and it works now.

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

Please let me know if somebody is still affected. The validation of custom keyword was simply incorrect, and now it is fixed. But it is still a bit more restrictive than it was - it would only fail though if e.g. somebody used 0 instead of false, which seems unlikely.

@epoberezkin
Copy link
Member

epoberezkin commented Feb 10, 2019

It probably is possible to make travis CI run tests of some dependencies against the new tags (e.g. webpack and eslint).

@csvan
Copy link

csvan commented Feb 10, 2019

@epoberezkin thanks for the fix!

@epoberezkin
Copy link
Member

closing

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

No branches or pull requests