我正在我的新 M1 芯片机(Mac)上为 Nuxt 项目开发环境。 问题是Nuxt项目的构建速度太慢了。
我将nodenv安装到我的项目中,并使用v12.9.0。在项目文件夹中,使用的包maneger(npm/yarn)位于
/Users/username/.nodenv/shims/node
.
运行
yarn install
和yarn dev
后,编译(客户端加服务器)大约需要2小时。
如果我在我的英特尔机器(Mac)中运行
yarn dev
,构建只需几秒钟。
如果您对隔离问题的步骤有任何想法,请教我。 谢谢,
【我的做法】
node_modules
并通过 yarn install
重新安装它们。【环境】
【模块】 我的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"
}
我自己解决了这个问题。
16.0.0
node-sass
,请将其删除。sass
和 [email protected]
yarn install
& yarn dev
这对我来说非常有效。