yeoman / yo

CLI tool for running Yeoman generators
http://yeoman.io
BSD 2-Clause "Simplified" License
3.85k stars 399 forks source link

Yo 3.0.0 not installable with yarn on node8 due to global-agent requiring node10 #625

Open fluff opened 5 years ago

fluff commented 5 years ago

Type of issue

Bug

Yo 3.0.0 fails to install with yarn on node8, because the dependency global-agent requires node10.

Apparently "yarn add" evaluates the "engines" requirements of dependencies and refuses to install, but "npm install" seems to be happy to put global-agent in node_modules even if it has an "engines" requirement that is not satisfied?


My environment

Expected behavior

In an empty directory, the following command used to work to install yeoman: yarn add yo. But since the 3.0 release a few days ago, this has stopped working on node8.

Current behavior

Yarn refuses to install yo on node 8 because it has a dependency global-agent@2.0.0 which requires node 10.

Steps to reproduce the behavior

yarn add yo in an empty directory with node 8 in the path.

Command line output

yarn add v1.16.0
info No lockfile found.
[1/4] Resolving packages...
warning yo > fullname > passwd-user > execa > cross-spawn-async@2.2.5: cross-spawn no longer requires a build toolchain, use it instead
warning yo > yeoman-doctor > bin-version-check > bin-version > execa > cross-spawn-async@2.2.5: cross-spawn no longer requires a build toolchain, use it instead
[2/4] Fetching packages...
error global-agent@2.0.0: The engine "node" is incompatible with this module. Expected version ">=10.0". Got "8.16.0"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
SBoudrias commented 5 years ago

You can use the --ignore-engines when using yarn: https://yarnpkg.com/lang/en/docs/cli/install/#toc-yarn-install-ignore-engines

I'm not sure how we can fix that on our side without removing functionality. Maybe we could leverage optionalDependencies, but then we'd need to conditionally require this module only if it is installed.

fluff commented 5 years ago

Thanks, --ignore-engines did the trick. Feel free to close this issue - or leave it open still, in case this is something that could be improved later.