简体   繁体   English

运行 vue-cli-service serve 时 Node.js 的 CPU 使用率高

[英]High CPU usage from Node.js when running vue-cli-service serve

The CPU usage by Node goes well over 100% when I run my npm script, which is using vue-cli-service serve .当我运行使用vue-cli-service serve npm 脚本时,Node 的 CPU 使用率超过 100%。 How can I debug this issue?我该如何调试这个问题?

I'm working on a Mac, Node installed through nvm.我在 Mac 上工作,Node 通过 nvm 安装。 Node version: 10.16, npm version: 6.9节点版本:10.16,npm 版本:6.9

在 MacOSX 上安装fsevents模块将有助于降低 CPU 使用率。

npm install fsevents -g

npm rebuild fsevents

The problem was caused by the polling option.问题是由轮询选项引起的。

Removing poll: true from the watchOptions in the webpack config - fixed the problem for me.从 webpack 配置中的watchOptions中删除poll: true - 为我解决了这个问题。

i use linux in virtualbox for dev purpose, and i have shared folder from windows host to linux guest.我在 virtualbox 中使用 linux 用于开发目的,并且我有从 Windows 主机到 linux 来宾的共享文件夹。 and my my vue project is stored in my hdd and shared with vbox.我的 vue 项目存储在我的硬盘中并与 vbox 共享。

so that i have to used {devServer: watchOptions: {poll: true}} in my vue.config.js for hot reload to works.所以我必须在我的 vue.config.js 中使用{devServer: watchOptions: {poll: true}}来热重载工作。 this was causing the high cpu usage problem.这导致了高 CPU 使用率问题。

so i put my code in guest hdd and set poll:false and problem has gone.所以我将我的代码放在来宾硬盘中并设置 poll:false 并且问题消失了。

hope someone find this helpfull.希望有人觉得这有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Angular CLI - ng serve - 节点进程的高 CPU 使用率 - Angular CLI - ng serve - high cpu usage from node process vue-cli-service:运行 npm run serve 时权限被拒绝 - vue-cli-service: Permission denied while running npm run serve 在Amazon ec2上运行的Node.js应用程序中分析高CPU使用率(使用Nodetime) - Profiling high CPU usage (with Nodetime) on my Node.js app running on Amazon ec2 node.js上Azure表存储的高CPU使用率 - High CPU Usage for Azure Table Storage on node.js Mongoose(node.js模块)导致高CPU使用率 - Mongoose (node.js module) causes high CPU usage node.js表示集群和高CPU使用率 - node.js express cluster and high CPU usage npm run serve 给出错误 sh: vue-cli-service: command not found in Vue Cli app - npm run serve gives error sh: vue-cli-service: command not found in Vue Cli app Node.js - 使用 createReadStream 和 createWriteStream 时 memory 使用率高 - Node.js - High memory usage when using createReadStream and createWriteStream 由于“spawn”,Node.js应用程序的CPU使用率很高,如何记录所有调用? - Node.js app has high CPU usage due to `spawn`, how can I log all calls to it? 如何防止 Node.js API REST 应用程序对高 CPU/RAM 使用率无响应? - How to prevent a Node.js API REST app to be unresponsive on high CPU/RAM usage?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM