-
- Notifications
You must be signed in to change notification settings - Fork 644
Description
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)