Deployment failing due to webpack-cli issue

My site’s deployment is failing with the following error:

9:35:30 PM: One CLI for webpack must be installed. These are recommended choices, delivered as separate packages:
9:35:30 PM: - webpack-cli (
9:35:30 PM: The original webpack full-featured CLI.
9:35:30 PM: We will use “npm” to install the CLI via “npm install -D”.
9:35:30 PM: Do you want to install ‘webpack-cli’ (yes/no):

I’m running npx webpack as part of the build command and it’s causing the above error.

The exact same setup works fine on the staging branch, which has the same code and configurations, but fails on the master branch. I didn’t do anything special for the staging branch.

My package.json has both webpack and webpack-cli as dev dependencies.

What do I need to do to resolve this issue?


I managed to resolve the issue. I had the NODE_ENV variable set to production, which was causing the build to ignore my dev dependencies.

1 Like