gpt4 book ai didi

node.js - 【M1芯片Mac】Nuxt构建太慢

转载 作者:行者123 更新时间:2023-12-04 14:04:14 26 4
gpt4 key购买 nike

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

  • 删除 node_modules并通过 yarn install 重新安装它们.
  • 重启我的机器
  • 简单的 nuxt 项目与在英特尔机器上的运行方式相同

  • 【环境】
  • M1芯片机
  • nodeenv (by homebrew)
  • nuxt/vue 项目

  • 【模块】
    我的 package.json 是这个,
    "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"
    }

    最佳答案

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

    关于node.js - 【M1芯片Mac】Nuxt构建太慢,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69056722/

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