Vue.js 卡在 40% 的服务上如何恢复?

spr*_*t12 6 node.js vue.js vue-cli

我决定删除节点模块文件夹,npm install然后做一个npm run serve它总是卡在 40% 左右并永远停留在那里。从 UI 完成后,它也会卡在类似的数量上:

$ vue-cli-service serve --open --mode development --https --dashboard INFO 正在启动开发服务器...

40% 构建 118/134 个模块 16 个活动 ...tApp\node_modules\axios\lib\defaults.js

下一次:

40% 构建 134/147 个模块 13 个活动 ...\node_modules\axios\lib\adapters\xhr.js

我注意到 Node.js 进程一直以 15% 左右的速度运行,但如果我等待、等待和等待,什么也不会发生。

在此处输入图片说明

包.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/"
  }
}
Run Code Online (Sandbox Code Playgroud)

$ node --version v10.15.3

我该如何从中恢复?

更新:数字 40 有一些神奇之处,我删除了所有提及 Axios 的内容,现在我仍然卡在 40% 处,但有不同的事情:

40% 构建 133/146 个模块 13 个活动 ...abel\runtime-corejs2\core-js\promise.js

小智 8

就我而言:

这是模板中的错误。确保在<template><container_tag> ... your code ...</container_tag></template>它之后有一个容器标签,就像 一个简单的<div>


Chr*_*zon 7

尝试运行npm run lint,看看您的代码中是否有一些错误。

我不小心将 v-bind:attribute 留空,例如<el :items=""></el>. 一旦解决,我就能够构建/服务。


小智 0

这似乎是由项目文件之一中的错误引起的,该错误阻止编译并压缩任何错误消息。

今天我个人对此感到困扰,并花了很多时间不必要地调试 WSL,然后才发现我的一个组件中的错误。

尝试注释掉或删除模板、组件注册和导入中的任何组件,直到它再次开始加载。