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

xxe27gdn  于 12个月前  发布在  Vue.js
关注(0)|答案(2)|浏览(283)

我正在我的新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,

"dependencies": {
    "@nuxt/typescript-runtime": "^0.4.0",
    "@nuxtjs/axios": "^5.9.5",
    "@nuxtjs/dotenv": "^1.4.1",
    "@nuxtjs/google-gtag": "^1.0.4",
    "@nuxtjs/gtm": "^2.4.0",
    "@nuxtjs/pwa": "^3.0.0-0",
    "@nuxtjs/style-resources": "^1.0.0",
    "@types/highlight.js": "^9.12.3",
    "@types/quill": "^2.0.3",
    "autolinker": "^3.13.0",
    "blob-util": "^2.0.2",
    "camelcase-keys": "^6.2.1",
    "cross-env": "^7.0.2",
    "crypto-js": "^4.0.0",
    "express": "^4.17.1",
    "highlight.js": "^9.18.1",
    "js-cookie": "^2.2.1",
    "npm-check-updates": "^4.0.6",
    "nuxt": "^2.12.1",
    "nuxt-basic-auth-module": "^1.3.2",
    "nuxt-clipboard2": "^0.2.1",
    "parchment": "^2.0.0-dev.2",
    "pm2": "^4.2.3",
    "quill-image-drop-and-paste": "^1.0.4",
    "sanitize-html": "^1.22.1",
    "snakecase-keys": "^3.1.2",
    "vue-infinite-loading": "^2.4.5",
    "vue-property-decorator": "^8.4.1",
    "vue-sanitize": "^0.2.0",
    "vue-scrollto": "^2.18.1",
    "vue-stripe-elements-plus": "^0.3.2",
    "vue-toc": "0.0.1",
    "vue-tweet-embed": "^2.4.0",
    "vue2-editor": "^2.10.2",
    "vuex-persistedstate": "^3.0.0"
  },
  "devDependencies": {
    "@nuxt/typescript-build": "^0.6.0",
    "@nuxtjs/eslint-config": "^5.0.0",
    "@nuxtjs/eslint-config-typescript": "^5.0.0",
    "@nuxtjs/eslint-module": "^3.0.1",
    "@nuxtjs/moment": "^1.6.0",
    "@nuxtjs/vuetify": "^1.11.0",
    "@types/jest": "^25.1.4",
    "@typescript-eslint/eslint-plugin": "^2.25.0",
    "@typescript-eslint/parser": "^2.25.0",
    "@vue/test-utils": "^1.0.0-beta.29",
    "babel-core": "^7.0.0-bridge.0",
    "babel-eslint": "^10.1.0",
    "babel-jest": "^25.2.1",
    "eslint": "^7.14.0",
    "eslint-config-prettier": "^6.15.0",
    "eslint-plugin-nuxt": "^2.0.0",
    "eslint-plugin-prettier": "^3.1.4",
    "jest": "^25.2.1",
    "node-sass": "^4.13.1",
    "nodemon": "^2.0.2",
    "prettier": "^2.2.0",
    "sass-loader": "^8.0.2",
    "ts-jest": "^25.2.1",
    "vue-jest": "^3.0.5"
  }

字符串

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
    这对我来说很完美。

相关问题