You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Windows下安装Vue CLI后执行vue -v报错的解决方法咨询

Vue CLI执行命令报错的解决方案

问题背景

Windows 7(版本6.1.7601)系统,已安装npm 9.2.0和Node.js v16.16.0,执行vue v(实际想查看Vue CLI版本)时触发以下错误:

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\Mara>vue v
node:os:68
      throw new ERR_SYSTEM_ERROR(ctx);
      ^

SystemError [ERR_SYSTEM_ERROR]: A system error occurred: uv_os_gethostname returned ENOSYS (function not implemented)
    at new Defaults (C:\node32\node_modules\@vue\cli\node_modules\@achrinza\node-ipc\entities\Defaults.js:26:20)
    at new Parser (C:\node32\node_modules\@vue\cli\node_modules\@achrinza\node-ipc\entities\EventParser.js:8:14)
    at Object.<anonymous> (C:\node32\node_modules\@vue\cli\node_modules\@achrinza\node-ipc\dao\client.js:11:19)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (C:\node32\node_modules\@vue\cli\node_modules\@achrinza\node-ipc\services\IPC.js:4:14) {
  code: 'ERR_SYSTEM_ERROR',
  info: {
    errno: -4054,
    code: 'ENOSYS',
    message: 'function not implemented',
    syscall: 'uv_os_gethostname'
  },
  errno: [Getter/Setter],
  syscall: [Getter/Setter]
}

错误原因

  1. 命令输入错误:正确查看Vue CLI版本的命令是vue -v或vue --version,vue v是无效命令,会触发异常调用流程。
  2. 系统兼容性问题:Node.js v16及以上版本不再官方支持Windows 7,其中uv_os_gethostname这个系统调用在Windows 7上无法正常工作,而Vue CLI依赖的@achrinza/node-ipc包会调用该接口,导致报错。

解决步骤

  • 第一步:修正命令
    先尝试用正确的版本查询命令执行:

    vue -v
    

    或

    vue --version
    
  • 第二步:降级Node.js版本(核心解决方法)
    Windows 7仅支持到Node.js v14.x LTS版本(推荐v14.21.3,最后一个兼容Windows 7的版本):

    1. 卸载当前安装的Node.js v16.16.0
    2. 下载对应32位的Node.js v14.x LTS安装包(你的Node路径是C:\node32,说明是32位系统)
    3. 安装完成后,重新全局安装Vue CLI:
      npm install -g @vue/cli
      
  • 第三步:清理缓存并重装Vue CLI(可选辅助步骤)
    如果降级后仍有问题,执行以下命令清理残留:

    npm uninstall -g @vue/cli
    npm cache clean --force
    npm install -g @vue/cli
    
  • 第四步:修复系统主机名(备选方案)
    若不想降级Node.js,可尝试修复系统主机名配置:

    1. 右键「我的电脑」→「属性」→「计算机名」→「更改」,设置一个合法的主机名后重启系统
    2. 或者在系统环境变量中添加COMPUTERNAME变量,值设为你的主机名

内容的提问来源于stack exchange,提问作者Narakaya

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.29 11:57:49