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

Should respect NODE_PATH when checking for existence of a package #3355

Closed
robert3005 opened this issue Jul 30, 2022 · 3 comments
Closed

Should respect NODE_PATH when checking for existence of a package #3355

robert3005 opened this issue Jul 30, 2022 · 3 comments
Labels

Comments

@robert3005
Copy link

Describe the bug

If you run webpack-cli with NODE_PATH (and not with node_modules in local directory) you end up with request to install dependencies even though everything is properly configured, i.e.
NODE_PATH=<includes all webpack and webpack-cli dependencies> webpack-cli -config <config> build

What is the current behavior?

You get prompted for

[webpack-cli] For using 'build' command you need to install: 'webpack' package.
[webpack-cli] Would you like to install 'webpack' package? (That will run 'npm install -D webpack') (Y/n)

To Reproduce

Steps to reproduce the behavior:

I believe this will happen in any case where you have webpack installed in a sibling directory than your current working directory which you refer to using NODE_PATH

Expected behavior

webpack-cli should only ask to install dependencies if they don't exist and not when webpack can't find them in local directory

Screenshots

Please paste the results of npx webpack-cli info here, and mention other relevant information

Additional context

I believe this bug has been introduced in #2761 where the previous logic looked to be correct (at least reverting to that logic makes NODE_PATH packages work)

@robert3005 robert3005 added the Bug label Jul 30, 2022
@robert3005 robert3005 changed the title Cli should respect NODE_PATH when checking for existence of a package Should respect NODE_PATH when checking for existence of a package Jul 30, 2022
@alexander-akait
Copy link
Member

alexander-akait commented Jul 31, 2022

This PR is workaround for limitation when you use npm/yarn and a package doesn't exits in the installation time, anyway feel free to fix code and respect NODE_PATH

@snitin315
Copy link
Member

Fixed in #3411

@robert3005
Copy link
Author

Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants