MacOS上vue-cli项目发热严重,node占用cpu大!

MacOS上vue-cli项目发热严重,node占用cpu大!

1. 现象

在MacOS 上启动vue-cli的项目,电脑6,7位置过热(烫手)🥵

2. 分析

项目是从仓库中拖下来的,直接npm install,运行…
mac开始旋转小风扇微波加热什么东西…

没啥特别的配置,它在干啥?
打开活动监视器,node占用cpu过高!嗯…那就是它了

为什么node会占用高呢?查了一圈是fsevents的问题

fsevents

Native access to MacOS FSEvents in Node.js
The FSEvents API in MacOS allows applications to register for notifications of changes to a given directory tree. It is a very fast and lightweight alternative to kqueue.
This is a low-level library. For a cross-platform file watching module that uses fsevents, check out Chokidar.

所以,我的fsevents出了啥问题???🧐

难道是node_modules中的它…应该不是bug,那差不多就是版本问题了。

package-lock.json

package-lock.json is automatically generated for any operations where npm modifies either the node_modules tree, or package.json. It describes the exact tree that was generated, such that subsequent installs are able to generate identical trees, regardless of intermediate dependency updates.

3. 检测解决方案

删除package-lock.json
选择性的删除(我是直接删除了)node_modules

重新npm install
npm run dev

此时监视器中node依然很高😥

项目启动完成了,emm…
成功了😃

4. 结论

项目安装时候fsevents安装应该不符合我的电脑(版本),删除老版本的重新安装就可以了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值