How to fix webpack: not found Sage build error

On this site:, we’re running Sage in a Docker container and building with yarn run build but keep getting the error:

> sage@9.0.0-beta.3 build /var/www/html/wp-content/themes/radish
> webpack --progress --config resources/assets/build/webpack.config.js

sh: 1: webpack: not found
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! sage@9.0.0-beta.3 build: `webpack --progress --config resources/assets/build/webpack.config.js`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the sage@9.0.0-beta.3 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm==> Building custom blocks
 ERR!     /root/.npm/_logs/2019-10-31T22_36_50_737Z-debug.log
audited 15834 packages in 6.825s
found 424 vulnerabilities (6 low, 25 moderate, 393 high)
  run `npm audit fix` to fix them, or `npm audit` for details
npm WARN radish-blocks@1.0.1 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

However, we do have webpack in our devDependencies in package.json:

"webpack": "^4.41.2",
"webpack-assets-manifest": "^0.6.2",
"webpack-dev-middleware": "^1.12.0",
"webpack-hot-middleware": "^2.18.2",
"webpack-merge": "^4.1.0",

and yarn list webpack returns:

yarn list v1.10.1
warning ../../../package.json: No license field
warning Filtering by arguments is deprecated. Please use the pattern option instead.
├─ buble-loader@0.4.1
│  └─ webpack@4.41.2
└─ webpack@2.7.0
Done in 0.79s.

Node version is v10.15.3.

Any idea how to resolve?

This topic was automatically closed after 42 days. New replies are no longer allowed.