Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vue.js stuck on serving at 40% how to recover?

I decided to delete the node modules folder, do a npm install then do a npm run serve it always gets stuck around 40% and stays there forever. When done from the UI it also gets stuck on a similar amount:

$ vue-cli-service serve --open --mode development --https --dashboard INFO Starting development server...

40% building 118/134 modules 16 active ...tApp\node_modules\axios\lib\defaults.js

another time:

40% building 134/147 modules 13 active ...\node_modules\axios\lib\adapters\xhr.js

I notice Node.js process is constantly going at around 15%, but nothing happens if I wait and wait and wait.

enter image description here

Package.json

{
  "name": "myapp",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint",
    "test:e2e": "vue-cli-service test:e2e",
    "test:unit": "vue-cli-service test:unit"
  },
  "dependencies": {
    "@aspnet/signalr": "^1.1.4",
    "axios": "^0.18.0",
    "vue": "^2.6.10",
    "vue-axios": "^2.1.4",
    "vue-router": "^3.0.6",
    "vuex": "^3.1.1"
  },
  "devDependencies": {
    "@vue/cli-plugin-babel": "^3.7.0",
    "@vue/cli-plugin-e2e-cypress": "^3.7.0",
    "@vue/cli-plugin-eslint": "^3.7.0",
    "@vue/cli-plugin-unit-jest": "^3.7.0",
    "@vue/cli-service": "^3.7.0",
    "@vue/eslint-config-standard": "^4.0.0",
    "@vue/test-utils": "^1.0.0-beta.20",
    "babel-core": "7.0.0-bridge.0",
    "babel-eslint": "^10.0.1",
    "babel-jest": "^23.6.0",
    "eslint": "^5.16.0",
    "eslint-plugin-vue": "^5.2.2",
    "node-sass": "^4.12.0",
    "sass-loader": "^7.1.0",
    "vue-template-compiler": "^2.6.10"
  },
  "eslintConfig": {
    "root": true,
    "env": {
      "node": true
    },
    "extends": [
      "plugin:vue/essential",
      "@vue/standard"
    ],
    "rules": {
      "space-before-function-paren": [
        "error",
        {
          "anonymous": "always",
          "named": "always",
          "asyncArrow": "always"
        }
      ],
      "keyword-spacing": [
        "error",
        {
          "after": true
        }
      ],
      "semi": [
        "error",
        "always"
      ],
      "indent": "off",
      "vue/script-indent": [
        "warn",
        2,
        {
          "baseIndent": 1
        }
      ]
    },
    "parserOptions": {
      "parser": "babel-eslint"
    }
  },
  "postcss": {
    "plugins": {
      "autoprefixer": {}
    }
  },
  "browserslist": [
    "> 1%",
    "last 2 versions",
    "not ie <= 8"
  ],
  "jest": {
    "moduleFileExtensions": [
      "js",
      "jsx",
      "json",
      "vue"
    ],
    "transform": {
      "^.+\\.vue$": "vue-jest",
      ".+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$": "jest-transform-stub",
      "^.+\\.jsx?$": "babel-jest"
    },
    "moduleNameMapper": {
      "^@/(.*)$": "<rootDir>/src/$1"
    },
    "snapshotSerializers": [
      "jest-serializer-vue"
    ],
    "testMatch": [
      "**/tests/unit/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)"
    ],
    "testURL": "http://localhost/"
  }
}

$ node --version v10.15.3

How do I recover from this?

Update: There is something magic about the number 40, I removed all mentions of Axios and now I still get stuck at 40% but with a different thing:

40% building 133/146 modules 13 active ...abel\runtime-corejs2\core-js\promise.js

like image 359
sprocket12 Avatar asked May 20 '19 10:05

sprocket12


3 Answers

In my case:

It was an error into the template. Make sure there is a container tag just after <template><container_tag> ... your code ...</container_tag></template> it could be as simple as a <div>

like image 178
Jose R Avatar answered Oct 10 '22 15:10

Jose R


Try running npm run lint and see if you've got some errors in your code.

I had accidentally left an v-bind:attribute empty, e.g. <el :items=""></el>. Once resolved, I was able to build/serve.

like image 44
Christopher Janzon Avatar answered Oct 10 '22 15:10

Christopher Janzon


I my case there was:

  1. git conflict
  2. a tag was not completely closed it was like <div> ..... </div but vs code was not showing this error. when I opened every component, it highlighted the error
like image 27
Saad Saif Avatar answered Oct 10 '22 15:10

Saad Saif