vue.js M1 Chip Mac上的Nuxt构建速度太慢

xxe27gdn  于 2023-11-21  发布在  Vue.js
关注(0)|答案(2)|浏览(385)

我正在我的新M1芯片机器(Mac)上为Nuxt项目开发环境。问题是Nuxt项目的构建速度太慢。
我把nodenv安装到我的项目中,并使用v12.9.0。在项目文件夹中,使用的包管理器(npm / yarn)在/Users/username/.nodenv/shims/node中。
在运行yarn installyarn dev之后,编译(客户端加服务器)大约需要2个小时。
如果我在我的Intel机器(Mac)上运行yarn dev,构建只需要几秒钟。
如果你有任何想法的步骤,以隔离的问题,请教我。谢谢,
[我的方法]

  • 删除node_modules并通过yarn install重新安装。
  • 重新启动我的机器
  • 简单的nuxt项目与Intel Machine上的运行方式相同

[环境]

  • M1芯片机
  • nodenv(通过homebrew)
  • nuxt / vue项目

[modules] my package.json is this,

  1. "dependencies": {
  2. "@nuxt/typescript-runtime": "^0.4.0",
  3. "@nuxtjs/axios": "^5.9.5",
  4. "@nuxtjs/dotenv": "^1.4.1",
  5. "@nuxtjs/google-gtag": "^1.0.4",
  6. "@nuxtjs/gtm": "^2.4.0",
  7. "@nuxtjs/pwa": "^3.0.0-0",
  8. "@nuxtjs/style-resources": "^1.0.0",
  9. "@types/highlight.js": "^9.12.3",
  10. "@types/quill": "^2.0.3",
  11. "autolinker": "^3.13.0",
  12. "blob-util": "^2.0.2",
  13. "camelcase-keys": "^6.2.1",
  14. "cross-env": "^7.0.2",
  15. "crypto-js": "^4.0.0",
  16. "express": "^4.17.1",
  17. "highlight.js": "^9.18.1",
  18. "js-cookie": "^2.2.1",
  19. "npm-check-updates": "^4.0.6",
  20. "nuxt": "^2.12.1",
  21. "nuxt-basic-auth-module": "^1.3.2",
  22. "nuxt-clipboard2": "^0.2.1",
  23. "parchment": "^2.0.0-dev.2",
  24. "pm2": "^4.2.3",
  25. "quill-image-drop-and-paste": "^1.0.4",
  26. "sanitize-html": "^1.22.1",
  27. "snakecase-keys": "^3.1.2",
  28. "vue-infinite-loading": "^2.4.5",
  29. "vue-property-decorator": "^8.4.1",
  30. "vue-sanitize": "^0.2.0",
  31. "vue-scrollto": "^2.18.1",
  32. "vue-stripe-elements-plus": "^0.3.2",
  33. "vue-toc": "0.0.1",
  34. "vue-tweet-embed": "^2.4.0",
  35. "vue2-editor": "^2.10.2",
  36. "vuex-persistedstate": "^3.0.0"
  37. },
  38. "devDependencies": {
  39. "@nuxt/typescript-build": "^0.6.0",
  40. "@nuxtjs/eslint-config": "^5.0.0",
  41. "@nuxtjs/eslint-config-typescript": "^5.0.0",
  42. "@nuxtjs/eslint-module": "^3.0.1",
  43. "@nuxtjs/moment": "^1.6.0",
  44. "@nuxtjs/vuetify": "^1.11.0",
  45. "@types/jest": "^25.1.4",
  46. "@typescript-eslint/eslint-plugin": "^2.25.0",
  47. "@typescript-eslint/parser": "^2.25.0",
  48. "@vue/test-utils": "^1.0.0-beta.29",
  49. "babel-core": "^7.0.0-bridge.0",
  50. "babel-eslint": "^10.1.0",
  51. "babel-jest": "^25.2.1",
  52. "eslint": "^7.14.0",
  53. "eslint-config-prettier": "^6.15.0",
  54. "eslint-plugin-nuxt": "^2.0.0",
  55. "eslint-plugin-prettier": "^3.1.4",
  56. "jest": "^25.2.1",
  57. "node-sass": "^4.13.1",
  58. "nodemon": "^2.0.2",
  59. "prettier": "^2.2.0",
  60. "sass-loader": "^8.0.2",
  61. "ts-jest": "^25.2.1",
  62. "vue-jest": "^3.0.5"
  63. }

字符串

xwbd5t1u

xwbd5t1u1#

正如预期的那样,Nuxt没有实际问题。
yarn dev需要12秒,而yarn build(因为target: server是默认值)只需要大约7秒。
到目前为止,你可能还有其他问题。


的数据

kmynzznz

kmynzznz2#

我自己解决了这个问题。
1.使用版本节点16.0.0
1.如果使用node-sass,请删除它。
1.而是安装sass[[email protected]](https://stackoverflow.com/cdn-cgi/l/email-protection)

  1. yarn installyarn dev
    这对我来说很完美。

相关问题