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

Generator version is not applied with npx when another version is installed globally #567

Closed
LazarusX opened this issue Jan 8, 2019 · 2 comments

Comments

@LazarusX
Copy link

LazarusX commented Jan 8, 2019

Type of issue

Bug?


My environment

  • OS version/details: Windows 10 64-bit
  • Node version: 10.11.0
  • npm version: 6.5.0
  • Version of yo : 2.0.5

Expected behavior

Yeoman chooses the generator installed by npx over that installed globally.

Current behavior

When executing with npx, generator version is not applied when another version is installed globally

Steps to reproduce the behavior

  1. Install Yeoman and a generator globally npm i -g yo generator-generator
  2. Run npx command with another version of generator npx -p yo -p [email protected] -- yo generator-generator. The globally installed generator (latest) is used instead of 3.0.0
@SBoudrias
Copy link
Member

Hey, thanks for the bug report.

The logic for where Yeoman will look for generators is defined in this file https://github.com/yeoman/environment/blob/master/lib/resolver.js#L128 (specifically this function for NPM paths)

I think we'll need to add a relative path aware of the NPX folder structure if we want this to take priority. Interested in sending a PR?

@JoshuaKGoldberg JoshuaKGoldberg transferred this issue from yeoman/yo Jan 23, 2025
@mshima
Copy link
Member

mshima commented Jan 23, 2025

npx is designed to be a temporary folder I don’t think we should lookup for generators there.

We do have an alternative to install the package in runtime like an integrated npx.
Not sure it’s enabled by default.

Closing.

@mshima mshima closed this as not planned Won't fix, can't repro, duplicate, stale Jan 23, 2025
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