flow-typed: "Invalid Version: undefined" semver on version 3.x flow-typed

Do you want to request a feature or report a bug? bug

What is the current behavior? after running yarn flow-typed install

UNCAUGHT ERROR: TypeError: Invalid Version: undefined
    at new SemVer (/path/project/node_modules/flow-typed/node_modules/semver/classes/semver.js:22:13)
error Command failed with exit code 1.

If the current behavior is a bug, please provide the steps to reproduce.

  • Install Fresh CRA
  • install flow-bin flow-typed
  • run yarn flow init
  • run yarn flow-typed install

What is the expected behavior?

  • should generate the flow-typed directory

If this is a feature request, what is motivation or use case for changing the behavior?

Local Environment Information If this issue is specific to the CLI, provide the results of running npx envinfo from the command line in a GitHub gist.

kubuntu: 19.04 node: 10.18.1 flow-typed: 3.1.0 flow-bin: 0.122.0

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 30
  • Comments: 21 (7 by maintainers)

Commits related to this issue

Most upvoted comments

You can also pin using yarn resolutions in package.json.

https://classic.yarnpkg.com/en/docs/selective-version-resolutions/#toc-how-to-use-it

"resolutions": {
    "flow-typed/semver": "7.1.3"
  }

This is almost certainly due to this bug.

I’m still seeing the same error with v3.2.0

+ flow-typed@3.2.0
added 111 packages from 58 contributors and audited 2085 packages in 13.546s
61 packages are looking for funding
  run `npm fund` for details
found 13256 vulnerabilities (13255 low, 1 moderate)
  run `npm audit fix` to fix them, or `npm audit` for details
• Found 69 dependencies in package.json to install libdefs for. Searching...
• flow-typed cache not found, fetching from GitHub...
UNCAUGHT ERROR: TypeError: Invalid Version: undefined
    at new SemVer (/home/travis/build/Kinto/kinto-admin/node_modules/flow-typed/node_modules/semver/classes/semver.js:22:13)
    at outside (/home/travis/build/Kinto/kinto-admin/node_modules/flow-typed/node_modules/semver/ranges/outside.js:12:13)
    at Object.gtr (/home/travis/build/Kinto/kinto-admin/node_modules/flow-typed/node_modules/semver/ranges/gtr.js:3:42)
    at pkgVersionMatch (/home/travis/build/Kinto/kinto-admin/node_modules/flow-typed/dist/lib/npm/npmLibDefs.js:262:42)
    at defs.filter.def (/home/travis/build/Kinto/kinto-admin/node_modules/flow-typed/dist/lib/npm/npmLibDefs.js:281:82)
    at Array.filter (<anonymous>)
    at filterLibDefs (/home/travis/build/Kinto/kinto-admin/node_modules/flow-typed/dist/lib/npm/npmLibDefs.js:275:15)
    at findNpmLibDef (/home/travis/build/Kinto/kinto-admin/node_modules/flow-typed/dist/lib/npm/npmLibDefs.js:329:27)

Is there a workaround?

So far I’ve seen downgrading flow-typed (if one can) to v2.6.2 which uses an earlier major semver version, or manually pinning semver to a known good version in yarn.lock such as:

semver@^7.1.3:
  version "7.1.3"
  ...

Should be fixed as of v3.2.1

Please comment if not.

Is there an alternative workaround for those who don’t use yarn?

It looks like the “bug” from semver isn’t going to be fixed.

You can also pin using yarn resolutions in package.json.

https://classic.yarnpkg.com/en/docs/selective-version-resolutions/#toc-how-to-use-it

"resolutions": {
    "flow-typed/semver": "7.1.3"
  }

how do you run “flow-typed install” it still gives me the error

Also running into this and is a blocker for me upgrading from v2 -> v3 of flow-typed

Should be fixed as of v3.2.0

Please comment if not.