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

NPE when using Requirement.buildNPM with ^16.0.0-0 #63

Open
mealingr opened this issue Nov 3, 2021 · 2 comments
Open

NPE when using Requirement.buildNPM with ^16.0.0-0 #63

mealingr opened this issue Nov 3, 2021 · 2 comments

Comments

@mealingr
Copy link

mealingr commented Nov 3, 2021

Trying to create an npm version requirement of ^16.0.0-0 results in a NullPointerException i.e.

Requirement.buildNPM("^16.0.0-0");

gives

java.lang.NullPointerException: null
	at com.vdurmont.semver4j.Semver.<init>(Semver.java:26)
	at com.vdurmont.semver4j.Requirement.hyphenRequirement(Requirement.java:487)
	at com.vdurmont.semver4j.Requirement.evaluateReversePolishNotation(Requirement.java:338)
	at com.vdurmont.semver4j.Requirement.buildWithTokenizer(Requirement.java:138)
	at com.vdurmont.semver4j.Requirement.buildNPM(Requirement.java:112)

Whereas this requirement is parseable by node-semver (which is what npm uses) https://github.com/npm/node-semver i.e.

npm install -g semver
...
// In Node.js console
const semver = require('semver')
undefined
semver.satisfies('16.14.0', '^16.0.0-0')
true

This requirement can arise from e.g. trying to install enzyme-adapter-react-16 using npm 6.14.13
npm install [email protected]

Then in the package-lock.json you'll see

"enzyme-adapter-react-16": {
      "version": "1.15.6",
      ...
      "requires": {
        ...
        "react-test-renderer": "^16.0.0-0",
      }
    }
@piotrooo
Copy link

@mealingr if you are still interesting, I've made copy of this lib and fix bug reported by you. Look for version 2.0.1

@mealingr
Copy link
Author

@mealingr if you are still interesting, I've made copy of this lib and fix bug reported by you. Look for version 2.0.1

Thank you @piotrooo for taking the time to fix this, happy to take a look

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

No branches or pull requests

2 participants