flow-typed: Flow-typed install crashes if you have a package installed from a git URL
Here is the crash:
UNCAUGHT ERROR: Error: Malformed npm package name! Expected the name to be formatted as <PKGNAME>_v<MAJOR>.<MINOR>.<PATCH> but instead got mtwins
at parsePkgNameVer (/Users/noah.allen/.config/yarn/global/node_modules/flow-typed/dist/lib/npm/npmLibDefs.js:295:11)
at _callee6$ (/Users/noah.allen/.config/yarn/global/node_modules/flow-typed/dist/lib/npm/npmLibDefs.js:620:38)
at tryCatch (/Users/noah.allen/.config/yarn/global/node_modules/regenerator-runtime/runtime.js:45:40)
at Generator.invoke [as _invoke] (/Users/noah.allen/.config/yarn/global/node_modules/regenerator-runtime/runtime.js:271:22)
at Generator.prototype.(anonymous function) [as next] (/Users/noah.allen/.config/yarn/global/node_modules/regenerator-runtime/runtime.js:97:21)
at asyncGeneratorStep (/Users/noah.allen/.config/yarn/global/node_modules/flow-typed/dist/lib/npm/npmLibDefs.js:56:103)
at _next (/Users/noah.allen/.config/yarn/global/node_modules/flow-typed/dist/lib/npm/npmLibDefs.js:58:194)
at <anonymous>
As you can see, it got “mtwins” instead of what it was expecting. This matches a package I have linked through git: (note, I do have several more dependencies that I did not list here)
"dependencies": {
"lottie-react-native": "^2.6.1",
"rn-tooltip": "git+https://github.com/mtwins/rn-tooltip.git"
},
This happens when running:
flow-typed install lottie-react-native(a package I recently installed).flow-typed install
To get around this, I have to:
rm -rf flow-typedflow-typed install. This works successfully, unlike before deleting the folder
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 18
- Comments: 18 (13 by maintainers)
Commits related to this issue
- fix git package support; fixes #3363 Signed-off-by: Kirill Danshin <kirill@danshin.pro> — committed to kirillDanshin/flow-typed by kirillDanshin 5 years ago
- fix git package support; fixes #3363 Signed-off-by: Kirill Danshin <kirill@danshin.pro> — committed to kirillDanshin/flow-typed by kirillDanshin 5 years ago
- fix(getInstalledNpmLibDefs): fix <<STUB>> parsing partial fix for #3363 — committed to jedwards1211/flow-typed by jedwards1211 4 years ago
- fix(getInstalledNpmLibDefs): fix <<STUB>> parsing partial fix for #3363 — committed to jedwards1211/flow-typed by jedwards1211 4 years ago
- fix(getInstalledNpmLibDefs): fix <<STUB>> parsing (#3786) partial fix for #3363 — committed to flow-typed/flow-typed by jedwards1211 4 years ago
- fix git package support; fixes #3363 (#3537) * fix git package support; fixes #3363 Signed-off-by: Kirill Danshin <kirill@danshin.pro> * fix git support tests — committed to mwiencek/flow-typed by kirillDanshin 5 years ago
This is regression the latest minor release - can work around by pinning to the previous version:
Still happens for me with 2.6.2 😦
Finally should be good now 😃
@pascalduez I confirmed that I have the code from #3537 in my installed version of
flow-typed, it’s not fixing my issue, and I figured out exactly what’s going wrong.Like @noahtallen, I have a preexisting stub sitting in
flow-typedwith this at the top:Here’s a cleaner stack trace than OP:
getInstalledNpmLibDefsdoes this:But trying this out manually shows that
<<STUB>>doesn’t get matched:Better to just use
signedCodeVer.startsWith('<<STUB>>')here, and also, we must make it tolerate/repair absolutely any bad preexisting version string.. Because it can’t control what was put there previously by bugs that have since been fixed.any updates on #3537? that PR fixes this issue.
@knu, I just ran into this issue on 2.6.0. Pinning to 2.5.1 worked for me. It looks like git-based packages are (correctly?) skipping
npmLibDefs.parsePkgNameVerin 2.5.1, but a quick look through commits around the 2.5.2 release hasn’t turned up any obvious culprits for the regression 😕