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

install-peerdeps should handle/pass version ranges with spaces to yarn #31

Closed
nandub opened this issue Jun 23, 2018 · 5 comments
Closed

Comments

@nandub
Copy link
Contributor

nandub commented Jun 23, 2018

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

bug

What is the current behavior?

yarn add fails to install packages with version ranges.

yarn add v1.7.0
[1/4] 🔍  Resolving packages...
error An unexpected error occurred: "https://registry.yarnpkg.com/%3C5.0.0: Not found".
info If you think this is a bug, please open a bug report with the information provided in "/Users/nandub/development/chingu/Bears-Team-07/client/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
ERR The install process exited with error code 1.

yarn-error.log

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

$ install-peerdeps eslint-loader -d
install-peerdeps v1.8.0
It seems as if you are using Yarn. Would you like to use Yarn for the installation? (y/n) Y
Installing peerdeps for eslint-loader@latest.
yarn add eslint-loader@2.0.0 eslint@>=1.6.0 <5.0.0 webpack@>=2.0.0 <5.0.0 --dev

yarn add v1.7.0
[1/4] 🔍  Resolving packages...
error An unexpected error occurred: "https://registry.yarnpkg.com/%3C5.0.0: Not found".
info If you think this is a bug, please open a bug report with the information provided in "/Users/nandub/development/chingu/Bears-Team-07/client/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
ERR The install process exited with error code 1.

What is the expected behavior?

install-peerdeps should handle/pass version ranges to yarn when installing the packages.

Passing quotes to yarn seems to do the trick:

$ yarn add eslint-loader@2.0.0 eslint@">=1.6.0 <5.0.0" webpack@">=2.0.0 <5.0.0" --dev
yarn add v1.7.0
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 📃  Building fresh packages...
success Saved lockfile.
success Saved 0 new dependencies.
✨  Done in 20.81s.

Please mention your node.js, yarn and operating system version.

nodejs=8.11.3
yarn=1.7.0
MacOS=El Capitan (10.11.6)

@nathanhleung
Copy link
Owner

Thanks for this issue. I'll look into it ASAP.

@gwicksted
Copy link

Same issue with NPM:

install-peerdeps tslint-language-service

Results in:

install-peerdeps v1.8.0
Installing peerdeps for tslint-language-service@latest.
npm install tslint-language-service@0.9.9 typescript@>= 2.3.1 < 3 tslint@>= 4 < 6 --save

The system cannot find the file specified.
ERR The install process exited with error code 1.

It should instead run with quoted version range arguments:

npm install tslint-language-service@0.9.9 typescript@">= 2.3.1 < 3" tslint@">= 4 < 6"

NOTE: spaces are optional between operators (">=") and versions ("2.3.1") but NOT between versions ("2.3.1") and operators ("<") which are used when specifying both a lower and upper-bound.

Easiest fix I can see would be testing for whitespace and quoting the version range if one exists.

@nandub
Copy link
Contributor Author

nandub commented Oct 16, 2018

I just noticed this pull #4 should this pull has fixed this issue?

@gwicksted
Copy link

@nandub I believe you are correct given this statement at the bottom of the PR:

This also works for ranges specified as >=1.2.7 <1.3.0.

@nathanhleung
Copy link
Owner

nathanhleung commented Jan 7, 2019

This should be fixed in the latest release, v1.10.1. The current behavior is to read the range and install the later version if the range uses an inclusive comparator (e.g. <=), else install the earlier version.

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

3 participants