Asset optimizationError: The system cannot find the path specified / cross-spawn, enoent


I’m new to Roots/Sage, yarn, webpack… and have no idea how to diagnose this problem or even what it means.

I’m getting the error below when I try yarn build:production:

yarn build works fine.

$ yarn build:production
yarn run v1.19.1
$ webpack --env.production --progress --config resources/assets/build/webpack.config.js
 94% asset optimizationError: The system cannot find the path specified.

	at notFoundError ( ( theme_path ) ... \node_modules\cross-spawn\lib\enoent.js:11:11)
	at verifyENOENT ( ( theme_path ) ... \node_modules\cross-spawn\lib\enoent.js:46:16)
	at ChildProcess.cp.emit ( ( theme_path ) ... \node_modules\cross-spawn\lib\enoent.js:33:19)
	at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
error Command failed with exit code 1.
info Visit for documentation about this command.

I’m using:
Windows 10
npm 6.9.0
yarn 1.19.1
composer 1.9.2

Any help would be appreciated.

Thanks in advance,

It’s look like the package is damaged.

Go to “\node_modules\cross-spawn” folder through command prompt & install the package by yarn install or npm install based on the tool you use for package management.

Make sure, you don’t use both NPM & YARN in same project for package management. It will damage your packages.

Hope this helps… :+1:

Thank you for your reply.

I did as you told me but it didn’t work.

This is the output of ‘yarn install’ in cross-spawn folder, just in case it helps.

Otherwise I’m getting the same message as before when trying yarn build:production.

$ yarn install
yarn install v1.19.1

warning eslint > file-entry-cache > flat-cache > circular-json@0.3.3: CircularJS
ON is in maintenance only, flatted is its successor.
warning mocha > json3@3.3.2: Please use the native JSON object instead of JSON 3
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning " > @satazor/eslint-config@3.2.0" has unmet peer dependency "eslint-plug
[4/4] Building fresh packages...

success Saved lockfile.
Done in 7.85s.

Delete node_modules folder, then run yarn to rebuild.