安装vue cli报错
在命令提示符里用
cnpm install -g @vue/cli
安装vue,前面运行的好好的,到了第31就出错了
运行结果及详细报错内容
[31/35] vue@^2.6.14 installed at node_modules\.store\vue@2.7.16\node_modules\vue
[npminstall:runscript:error] @vue/cli-ui@5.0.8 › apollo-server-express@3.13.0 › apollo-server-types@3.8.0 › apollo-reporting-protobuf@3.4.0 › @apollo/protobufjs@1.2.6 run postinstall node scripts/postinstall error: Error: Command failed with ENOENT: node scripts/postinstall
spawn C:\Program Files\MySQL\MySQL Server 8.0\bin\ ENOENT
at ChildProcess._handle.onexit (node:internal/child_process:286:19)
at onErrorNT (node:internal/child_process:484:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
errno: -4058,
code: 'ENOENT',
syscall: 'spawn C:\\Program Files\\MySQL\\MySQL Server 8.0\\bin\\',
path: 'C:\\Program Files\\MySQL\\MySQL Server 8.0\\bin\\',
spawnargs: [Array],
originalMessage: 'spawn C:\\Program Files\\MySQL\\MySQL Server 8.0\\bin\\ ENOENT',
shortMessage: 'Command failed with ENOENT: node scripts/postinstall\n' +
'spawn C:\\Program Files\\MySQL\\MySQL Server 8.0\\bin\\ ENOENT',
command: 'node scripts/postinstall',
escapedCommand: 'node "scripts/postinstall"',
exitCode: undefined,
signal: undefined,
signalDescription: undefined,
stdout: undefined,
stderr: undefined,
failed: true,
timedOut: false,
isCanceled: false,
killed: false
}
Install fail! Error: run postinstall error, please remove node_modules before retry!
Command failed with ENOENT: node scripts/postinstall
spawn C:\Program Files\MySQL\MySQL Server 8.0\bin\ ENOENT
Error: Command failed with ENOENT: node scripts/postinstall
spawn C:\Program Files\MySQL\MySQL Server 8.0\bin\ ENOENT
at ChildProcess._handle.onexit (node:internal/child_process:286:19)
at onErrorNT (node:internal/child_process:484:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
npminstall version: 7.12.0
npminstall argv: D:\n_nodejs\node.exe D:\n_nodejs\node_global\node_modules\cnpm\node_modules\npminstall\bin\install.js --fix-bug-versions --china --userconfig=C:\Users\awake\.cnpmrc --disturl=https://cdn.npmmirror.com/binaries/node --registry=https://registry.npmmirror.com -g @vue/cli
我的解答思路和尝试过的方法:
我检查了MySQL的路径和环境变量,都没问题, 于是我用ai问了一下,
这个错误提示表明在尝试运行 @apollo/protobufjs 的 postinstall 脚本时出现了问题。但是,错误信息中提到的 spawn C:\Program Files\MySQL\MySQL Server 8.0\bin\ 部分是不正常的,因为 @apollo/protobufjs 的 postinstall 脚本不应该与 MySQL 的安装路径有任何关系。
然后看了解决方法,云里雾里的.并没有啥用