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

Running webpack binary directly fails silently when webpack-command is installed in parent #7998

paradite opened this Issue Sep 6, 2018 · 1 comment


None yet
1 participant
Copy link

paradite commented Sep 6, 2018

Bug report

What is the current behavior?
I have a project with yarn script:

"build": "./node_modules/.bin/webpack --mode development"

Somewhere in the parent folder, I have webpack-command installed locally.
Running yarn run build fails silently with exit code 0 (making yarn command succeed), giving the message:

You have installed webpack-cli and webpack-command together. To work with the "webpack" command you need only one CLI package, please remove one of them or use them directly via their binary.

If the current behavior is a bug, please provide the steps to reproduce.

What is the expected behavior?

There are two issues here:

  1. When webpack command is not executed successfully due to both webpack-cli and webpack-command are installed, it should not exit with code zero (suggesting it succeeded), it should fail and exit with non-zero exit code so that I know something went wrong.
  2. When running webpack directly via the binary, it should not fail to execute because of webpack-command installed in some parent directory. This was suggested in the error message itself:

please remove one of them or use them directly via their binary.

Other relevant information:

Relevant code responsible for checking for both webpack-cli and webpack-command installed and exiting with code zero:

webpack version: 4.17.2
Node.js version: 8.9.4
Operating System: macOS
Additional tools: yarn 1.9.4


This comment has been minimized.

Copy link

paradite commented Sep 6, 2018


I realized changing the script to directly use webpack-cli works.

"build": "./node_modules/.bin/webpack-cli --mode development"

So point 2 is not a bug, it was my mistake. But the exit code issue should still be valid.

sokra added a commit that referenced this issue Sep 6, 2018

@sokra sokra closed this in #8001 Sep 6, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.