Vue.js - 解决项目启动时报uv_os_gethostname returned ENOSYS错误
作者:hangge | 2023-08-11 10:15
1,问题描述
(1)从网上下载了一个 Vue 项目,使用 npm run serve 命令启动时,报如下错误:
E:\SVN\zlpt>npm run serve
> zlpt@1.0.1 serve
> vue-cli-service serve --open
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 (E:\SVN\zlpt\node_modules\node-ipc\entities\Defaults.js:26:20)
at new Parser (E:\SVN\zlpt\node_modules\node-ipc\entities\EventParser.js:8:14)
at Object.<anonymous> (E:\SVN\zlpt\node_modules\node-ipc\dao\client.js:15:19)
at Module._compile (node:internal/modules/cjs/loader:1196:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1250:10)
at Module.load (node:internal/modules/cjs/loader:1074:32)
at Function.Module._load (node:internal/modules/cjs/loader:909:12)
at Module.require (node:internal/modules/cjs/loader:1098:19)
at require (node:internal/modules/cjs/helpers:108:18)
at Object.<anonymous> (E:\SVN\zlpt\node_modules\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]
}
E:\SVN\zlpt>
(2)后来发现是系统版本的原因,我的使用的系统是 Windows 7,并且手动将 Node.js 版本升级到 16(点击查看升级办法)。而在高版本的系统下是不会出现这种问题的。
2,解决办法
(1)根据错误提示信息,找到出错入口文件:
E:\SVN\zlpt\node_modules\node-ipc\entities\Defaults.js
(2)然后指定位置添加如下代码即可:
os.hostname=()=>"localhost"
全部评论(0)