当 运行 vue-cli-service 服务时 Node.js 的高 CPU 使用率
High CPU usage from Node.js when running vue-cli-service serve
当我 运行 我的 npm 脚本使用 vue-cli-service serve
时,Node 的 CPU 使用率远远超过 100%。
我该如何调试这个问题?
我正在研究 Mac,通过 nvm 安装的节点。节点版本:10.16,npm 版本:6.9
在 MacOSX 上安装 fsevents
模块将有助于减少 CPU 的使用。
npm install fsevents -g
npm rebuild fsevents
问题是由轮询选项引起的。
从 webpack 配置中的 watchOptions
中删除 poll: true
- 为我解决了这个问题。
我在 virtualbox 中使用 linux 用于开发目的,并且我有从 windows 主机到 linux 来宾的共享文件夹。我的 vue 项目存储在我的硬盘中并与 vbox 共享。
所以我必须在我的 vue.config.js 中使用 {devServer: watchOptions: {poll: true}}
才能进行热重载。这导致了高 cpu 使用率问题。
所以我将我的代码放在来宾硬盘中并设置 poll:false,问题就解决了。
希望有人觉得这有用。
当我 运行 我的 npm 脚本使用 vue-cli-service serve
时,Node 的 CPU 使用率远远超过 100%。
我该如何调试这个问题?
我正在研究 Mac,通过 nvm 安装的节点。节点版本:10.16,npm 版本:6.9
在 MacOSX 上安装 fsevents
模块将有助于减少 CPU 的使用。
npm install fsevents -g
npm rebuild fsevents
问题是由轮询选项引起的。
从 webpack 配置中的 watchOptions
中删除 poll: true
- 为我解决了这个问题。
我在 virtualbox 中使用 linux 用于开发目的,并且我有从 windows 主机到 linux 来宾的共享文件夹。我的 vue 项目存储在我的硬盘中并与 vbox 共享。
所以我必须在我的 vue.config.js 中使用 {devServer: watchOptions: {poll: true}}
才能进行热重载。这导致了高 cpu 使用率问题。
所以我将我的代码放在来宾硬盘中并设置 poll:false,问题就解决了。
希望有人觉得这有用。