安装vue cli脚手架报错解决

本人在安装vue cli时发生以下报错:

[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

安装vue报错详情

我问了AI,AI说

这个错误表明在 postinstall 脚本执行过程中遇到了问题。具体来说,metalsmith 的某个版本尝试运行一个名为 metalsmith-migrated-plugins.js 的脚本,但是系统找不到这个脚本或者尝试从错误的路径(C:\Program Files\MySQL\MySQL Server 8.0\bin\)启动 node 命令。
这个问题似乎与 MySQL 没有任何直接关系,因为 MySQL 的安装目录被错误地用作 node 命令的执行路径。

我反复检查了系统path变量,并没有看到有MYsql的变量

我又搜了一大堆资料,也没有我这种类似情况的问题

然后反复安装卸载安装卸载

历经5天半,

就在刚刚发现了我的系统变量里有一个"ComSpec"的变量,

变量值是"C:\Program Files\MySQL\MySQL Server 8.0\bin"

然后我就想,是不是这个的原因?

然后我删了它(以防出错,我复制了一份)

然后再win+r运行一遍

cnpm install -g @vue/cli

发现安装成功!!!

运行vue -V,也无问题

问题解决👌~~

(虽然不晓得删了那个变量会有啥影响,但是目前没出现问题,后续出现问题再说哈哈哈)

  • 10
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值