npm webpack-cli:错误:未知系统错误-86

46scxncf  于 2023-04-21  发布在  Webpack
关注(0)|答案(3)|浏览(306)

我刚刚获得了一个新的mac与M1芯片,我想知道是否错误与此有关,因为在我的旧的我没有问题。

[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'
}

当命令启动时,会发生以下情况:

npm run dev

yarn encore dev

我已经尝试删除node_modules文件以及package-lock.json,并清除npm缓存,然后重新运行npm install,但没有任何效果。
建议?

s4chpxco

s4chpxco1#

今天我也拿到了我的新M1 Pro,我也遇到了同样的问题。有趣的是,X1 M0 N1 X正确地创建了所有文件。
首先我检查了xcode-select --install是否安装了-它是。
接下来,我检查了安装的git版本git --version-〉git version 2.32.0 (Apple Git-132),标准的Apple git。我通过自制软件brew install git安装了一个新的git,并重新启动了我的Mac。之后,错误就消失了。
如果这不能修复你的错误,也许这是一个奇怪的npm包。

hsgswve4

hsgswve42#

问题解决了,感谢@andreasm为我指明了正确的方向。我在检查xcode是否安装后用以下命令解释了自己:

xcode-select -p

它是,所以我没有进行更多的关注,今天只是出于好奇心通过执行:

xcode-select --install

错误消失了,道德:不要相信第一个命令。

scyqe7ek

scyqe7ek3#

这就是我的解决之道:
通过brew安装终端通知程序
brew安装终端通知程序
记下brew安装应用程序的文件夹/目录(对我来说,这是:/opt/homebrew/Cellar/terminal-notifier/2.0.0)
编辑项目中的nitificationscenter.js
node_modules/node-notifier/notifiers/notificationcenter.js
第10行左右:
'../vendor/mac.noindex/terminal-notifier.app/Contents/MacOS/terminal-notifier'
注解/删除它,并替换为新安装的brew终端通知程序的路径。对我来说,这是:
'/opt/homebrew/Cellar/terminal-notifier/2.0.0/terminal-notifier'
您必须为每个项目编辑notificationcenter.js。

相关问题