gpt4 book ai didi

node.js - Nuxt js开发环境中CPU使用率高

转载 作者:行者123 更新时间:2023-12-02 18:26:30 73 4
gpt4 key购买 nike

由于很少更新我的 docker 容器中的应用程序前端部分无法正常工作
它使用了 100% 以上的 Docker CPU,我的笔记本电脑 CPU 的 60/70%(风扇以 100% 运行)
而且 HMR 很慢

此问题不会出现在生产和其他笔记本电脑上

我尝试了来自不同论坛类似问题的很多东西,但没有任何效果

我将 Docker 重置为出厂默认设置,允许更多内存和 CPU
我更新了我的依赖项
我删除并恢复了我的 Node 模块

我不知道我应该检查什么来解决这个问题
MacOS Catalina 10.15.4Node v13.12.0
我的 package.json

{
"name": "front",
"version": "1.0.1",
"description": "My first-class Nuxt.js project",
"private": true,
"scripts": {
"dev": "nuxt",
"build": "nuxt build",
"start": "HOST=0.0.0.0 PORT=8080 nuxt start",
"generate": "nuxt generate",
"lint": "eslint --ext .js,.vue .",
"precommit": "npm run lint"
},
"config": {
"nuxt": {
"host": "0.0.0.0",
"port": "8080"
}
},
"dependencies": {
"@fullcalendar/core": "^4.3.1",
"@fullcalendar/daygrid": "^4.3.0",
"@fullcalendar/interaction": "^4.3.0",
"@fullcalendar/timegrid": "^4.3.0",
"@fullcalendar/vue": "^4.3.1",
"@nuxt/webpack": "^2.11.0",
"@nuxtjs/auth": "^4.5.3",
"@nuxtjs/axios": "^5.4.1",
"@nuxtjs/google-analytics": "^2.2.0",
"@nuxtjs/google-tag-manager": "^2.1.4",
"@nuxtjs/gtm": "^2.2.3",
"@nuxtjs/pwa": "^2.6.0",
"@nuxtjs/robots": "^2.0.0",
"@nuxtjs/router": "^1.3.2",
"@nuxtjs/sitemap": "^0.2.2",
"algoliasearch": "^4.1.0",
"cross-env": "^5.2.0",
"cxlt-vue2-toastr": "^1.1.0",
"date-fns": "^1.30.1",
"debug": "^4.1.1",
"gsap": "^2.1.3",
"jquery": "^3.4.1",
"libphonenumber-js": "^1.7.14",
"moment": "^2.24.0",
"node-sass": "^4.13.1",
"nuxt": "^2.11.0",
"nuxt-facebook-pixel-module": "^1.3.0",
"nuxt-google-maps-module": "^1.6.0",
"nuxt-jsonld": "^1.4.5",
"nuxt-token-auth": "^1.0.2",
"nuxt-user-agent": "^1.2.2",
"sass-loader": "^7.1.0",
"vee-validate": "^2.2.0",
"vue": "^2.6.11",
"vue-gallery": "^2.0.0",
"vue-i18n": "^8.10.0",
"vue-infinite-scroll": "^2.0.2",
"vue-instantsearch": "^2.7.0",
"vue-js-modal": "^1.3.33",
"vue-lazyload": "^1.2.6",
"vue-mq": "^1.0.1",
"vue-multiselect": "^2.1.6",
"vue-read-more": "^1.1.1",
"vue-scrollto": "^2.15.0",
"vue-sticky": "^3.3.4",
"vue-tawk": "^1.0.1",
"vue-upload-component": "^2.8.20",
"vue-wait": "^1.3.3",
"vue2-dropzone": "^3.5.8",
"vue2-leaflet": "^1.2.3",
"vuedraggable": "^2.20.0",
"vuejs-datepicker": "^1.5.4",
"vuejs-paginate": "^2.1.0",
"vueperslides": "^2.7.0"
},
"devDependencies": {
"babel-eslint": "^8.2.1",
"eslint": "^5.16.0",
"eslint-config-standard": "^12.0.0",
"eslint-loader": "^2.1.2",
"eslint-plugin-import": "^2.16.0",
"eslint-plugin-node": "^8.0.1",
"eslint-plugin-promise": "^4.0.1",
"eslint-plugin-standard": "^4.0.0",
"eslint-plugin-vue": "^4.7.1",
"nodemon": "^1.18.10"
}
}

最佳答案

可能是 webpack 的 watch 模式有问题。
如前所述here :

For some systems, watching many file systems can result in a lot of CPU or memory usage. It is possible to exclude a huge folder like node_modules


module.exports = {
//...
watchOptions: {
ignored: /node_modules/
}
};

在您的情况下(nuxt.js),只需添加到 nuxt.config.js
 watchers: {
webpack: {
ignored: /node_modules/
}
}

关于node.js - Nuxt js开发环境中CPU使用率高,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61910664/

73 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com