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

webpack init <npm package> fails when npm and yarn global directories do not match #266

Closed
dylanonelson opened this issue Feb 12, 2018 · 1 comment

Comments

@dylanonelson
Copy link
Contributor

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

What is the current behavior?
Commands like webpack init webpack-addons-demo fail when a custom prefix is configured in ~/.npmrc.

I believe the root cause is that yarn saves global lib packages to ~/.config/yarn/global/node_modules, even when a separate prefix is configured (at least, that is the behavior on my machine with yarn v1.3.2). The init command, however, searches in the location determined by the configured npm prefix. So when yarn is installed, the init command uses it to install the requested package but then fails because it can't find the just-installed package in the npm global directory.

screenshot 2018-02-11 22 31 19

yarn config list displays this value for prefix for npm, and none for yarn:
prefix: '/Users/dylanonelson/.npm-packages',

If the current behavior is a bug, please provide the steps to reproduce.
Run webpack init webpack-addons-demo with yarn installed. The error is reproducible with and without a custom npm prefix, at least on my machine.

What is the expected behavior?
The command should not fail when the generator package has been installed.

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

Please mention other relevant information such as the browser version, Node.js version, Operating System and programming language.

@evenstensberg
Copy link
Member

Submit a PR :)

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

2 participants