ffblord
ffblord

Reputation: 413

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"
  ]
}

Upvotes: 9

Views: 13901

Answers (2)

Rm558
Rm558

Reputation: 5002

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

Upvotes: 1

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.

Upvotes: 0

Related Questions