Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is npm run serve building slow on Vue.js?

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-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"
  ]
}
like image 583
ffblord Avatar asked Feb 21 '19 21:02

ffblord


1 Answers

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

enter image description here

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

enter image description here

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.

enter image description here

like image 170
Rm558 Avatar answered Oct 18 '22 21:10

Rm558