webpack-cli : Error: spawn Unknown system error -86 / Symfony

Viewed 947

I have just acquired a new mac with M1 chip and I wonder if the error is related to this, because on my old one I have no problem.

[webpack-cli] Error: spawn Unknown system error -86
    at ChildProcess.spawn (node:internal/child_process:412:11)
    at spawn (node:child_process:698:9)
    at Object.execFile (node:child_process:325:17)
    at Object.module.exports.fileCommandJson (/Users/mlc/Sites/ImapImport/node_modules/node-notifier/lib/utils.js:88:13)
    at NotificationCenter.notifyRaw (/Users/mlc/Sites/ImapImport/node_modules/node-notifier/notifiers/notificationcenter.js:81:11)
    at WebpackNotifierPlugin.compilationDone (/Users/mlc/Sites/ImapImport/node_modules/webpack-notifier/index.js:129:14)
    at Hook.eval [as callAsync] (eval at create (/Users/mlc/Sites/ImapImport/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:18:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/Users/mlc/Sites/ImapImport/node_modules/tapable/lib/Hook.js:18:14)
    at /Users/mlc/Sites/ImapImport/node_modules/webpack/lib/Compiler.js:498:23
    at Compiler.emitRecords (/Users/mlc/Sites/ImapImport/node_modules/webpack/lib/Compiler.js:906:5) {
  errno: -86,
  code: 'Unknown system error -86',
  syscall: 'spawn'
}

It occurs when the command is launched:

npm run dev

or

yarn encore dev

I have already tried deleting the node_modules file as well as the package-lock.json, and clearing the npm cache then re-running npm install but nothing worked.

Suggestions ?

2 Answers

Today I got my new M1 Pro as well and I had the same issue. The interesting thing is that the npm run prod created all files correctly.

First I checked if xcode-select --install is installed - it was.

Next I checked the installed git version git --version -> git version 2.32.0 (Apple Git-132), standard Apple git. I installed a fresh git via homebrew brew install git and restarted my Mac. After that the error was gone.

If this does not fix your error, maybe it is an weird npm package.

Problem solved, thanks to @andreasm for pointing me in the right direction. I explain myself after checking on xcode was installed with the command :

xcode-select -p

it was, so I did not carry more attention than that, today just out of curiosity by executing :

xcode-select --install

the error has disappeared, morality: Do not trust the first command.

Related