npm ERR! missing script: server npm ERR! npm ERR! Did you mean this? npm ERR! serve npm ERR! A complete log of this run can be found in:

遇到的bug是

npm ERR! missing script: server npm ERR! npm ERR! Did you mean this? npm ERR!     serve  npm ERR! A complete log of this run can be found in:

因为

npm  run server

看了很多博客还是没解决

于是我用了以下的办法解决

npm install

我的pack

{
  "name": "vueblog-vue",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",              
    "build": "vue-cli-service build"
  },
  "dependencies": {
    "axios": "^0.19.2",
    "core-js": "^3.6.4",
    "element-ui": "^2.13.1",
    "github-markdown-css": "^5.1.0",
    "markdown-it": "^11.0.0",
    "mavon-editor": "^2.9.0",
    "vue": "^2.6.11",
    "vue-router": "^3.1.6",
    "vuex": "^3.1.3"
  },
  "devDependencies": {
    "@vue/cli-plugin-babel": "~4.3.0",
    "@vue/cli-plugin-router": "~4.3.0",
    "@vue/cli-plugin-vuex": "~4.3.0",
    "@vue/cli-service": "~4.3.0",
    "vue-template-compiler": "^2.6.11"
  },
  "browserslist": [
    "> 1%",
    "last 2 versions",
    "not dead"
  ]
}

将 serve 和 build的后面那些下载一次

npm vue-cli-service serve
npm vue-cli-service build

然后再执行

npm run serve

如果报错误

 ERROR  Failed to compile with 1 errors                                                                     下午10:58:58

This dependency was not found:

* github-markdown-css in ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modul
es/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/views/BlogDetail.vue?vue&t
ype=script&lang=js&

To install it, you can run: npm install --save github-markdown-css

跟着提示

再运行

npm install --save github-markdown-css

再运行

npm run serve
Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐