[英]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.