admin管理员组

文章数量:1334931

I have a project on Vue.js for which I run npm run serve in order to set up the server. Although this was working fine until an hour ago, suddently my project takes ages to build, more specifically it is stuck since more that 5 minutes on 32%. Does anyone know what I need to do in order to fix that? I am not sure which files I need to upload in order solve this problem, but here is my package.json file:

{
  "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-piler": "^2.5.21",
    "webpack-dev-server": "^3.1.14"
  },
  "eslintConfig": {
    "root": true,
    "env": {
      "node": true
    },
    "extends": [
      "plugin:vue/essential",
      "eslint:remended"
    ],
    "rules": {},
    "parserOptions": {
      "parser": "babel-eslint"
    }
  },
  "postcss": {
    "plugins": {
      "autoprefixer": {}
    }
  },
  "browserslist": [
    "> 1%",
    "last 2 versions",
    "not ie <= 8"
  ]
}

I have a project on Vue.js for which I run npm run serve in order to set up the server. Although this was working fine until an hour ago, suddently my project takes ages to build, more specifically it is stuck since more that 5 minutes on 32%. Does anyone know what I need to do in order to fix that? I am not sure which files I need to upload in order solve this problem, but here is my package.json file:

{
  "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-piler": "^2.5.21",
    "webpack-dev-server": "^3.1.14"
  },
  "eslintConfig": {
    "root": true,
    "env": {
      "node": true
    },
    "extends": [
      "plugin:vue/essential",
      "eslint:remended"
    ],
    "rules": {},
    "parserOptions": {
      "parser": "babel-eslint"
    }
  },
  "postcss": {
    "plugins": {
      "autoprefixer": {}
    }
  },
  "browserslist": [
    "> 1%",
    "last 2 versions",
    "not ie <= 8"
  ]
}
Share Improve this question asked Feb 21, 2019 at 21:45 ffblordffblord 4133 gold badges7 silver badges14 bronze badges 1
  • If any changes were made to the project, try reverting them to investigate a line of code that slows the build. If no such changes can be highlighted, it is possible that issue is not with the project but with development machine. Easy way to check is to try on another machine, ofc. Or at least reboot and check resources usage on the machine. Otherwise, question is too broad to give a meaningful answer. – aBiscuit Commented Feb 21, 2019 at 23:17
Add a ment  | 

2 Answers 2

Reset to default 1

Had a similar issue, it's caused by a inplete html tag in a .vue file.

I use eslint for vue, in the bottom of vs code, it shows the location of the issue.

btw, using Ctrl + C can terminate the 'npm run serve', however the process keeps running in background. Restart VS code finally killed the build process & released the CPU resources.

If you are using Ubuntu (Or if you are other user facing this issue using Ubuntu). It could be that there is no enough ram memory on your system. You could try adding swarp memory it may help. Also in case you are facing this problem in the server you should consider build the project instead.

If you are using other OS I don't know what could be. Try deleting the node_modules directory and re-installing dependencies.

本文标签: javascriptWhy is npm run serve building slow on VuejsStack Overflow