[英]Why is npm run serve building slow on Vue.js?
我在 Vue.js 上有一個項目,我運行npm run serve來設置服務器。 盡管直到一個小時前這還可以正常工作,但突然間我的項目需要很長時間才能構建,更具體地說,它在 32% 上停留了超過 5 分鍾。 有誰知道我需要做什么才能解決這個問題? 我不確定我需要上傳哪些文件才能解決這個問題,但這是我的package.json文件:
{
"name": "web",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"jwt-decode": "^2.2.0",
"password-validator": "^4.1.1",
"vue": "^2.5.22",
"vue-cookies": "^1.5.12",
"vue-router": "^3.0.1",
"vuex": "^3.0.1"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^3.4.0",
"@vue/cli-plugin-eslint": "^3.4.0",
"@vue/cli-service": "^3.4.0",
"axios": "^0.18.0",
"babel-eslint": "^10.0.1",
"eslint": "^5.8.0",
"eslint-plugin-vue": "^5.0.0",
"vue-cli-plugin-axios": "0.0.4",
"vue-template-compiler": "^2.5.21",
"webpack-dev-server": "^3.1.14"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/essential",
"eslint:recommended"
],
"rules": {},
"parserOptions": {
"parser": "babel-eslint"
}
},
"postcss": {
"plugins": {
"autoprefixer": {}
}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
]
}
如果您使用的是 Ubuntu(或者如果您是使用 Ubuntu 遇到此問題的其他用戶)。 可能是您的系統上沒有足夠的 ram 內存。 您可以嘗試添加 swarp 內存,它可能會有所幫助。 此外,如果您在服務器中遇到此問題,您應該考慮構建項目。
如果您使用其他操作系統,我不知道可能是什么。 嘗試刪除 node_modules 目錄並重新安裝依賴項。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.