yarn serve报错“/bin/sh: vue-cli-service: command not found”

报错信息

yarn serve报错“/bin/sh: vue-cli-service: command not found”_第1张图片

问题原因

依赖包失效

解决

终端输入 yarn,重新安装依赖
yarn serve报错“/bin/sh: vue-cli-service: command not found”_第2张图片
启动成功
yarn serve报错“/bin/sh: vue-cli-service: command not found”_第3张图片
Over~

package.json

{
  "name": "vue3-demo",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "lint": "eslint --fix --ext .js,.vue src"
  },
  "dependencies": {
    "core-js": "^3.8.3",
    "dayjs": "^1.11.6",
    "element-plus": "^2.2.23",
    "sass": "^1.56.1",
    "sass-loader": "^13.2.0",
    "vue": "^3.2.13",
    "vue-router": "^4.1.6",
    "vuex": "^4.1.0"
  },
  "devDependencies": {
    "@babel/core": "^7.12.16",
    "@babel/eslint-parser": "^7.12.16",
    "@vue/cli-plugin-babel": "~5.0.0",
    "@vue/cli-plugin-eslint": "~5.0.0",
    "@vue/cli-service": "~5.0.0",
    "babel-eslint": "^10.1.0",
    "compression-webpack-plugin": "^10.0.0",
    "eslint": "^8.28.0",
    "eslint-plugin-vue": "^9.7.0",
    "svg-sprite-loader": "^6.0.11"
  },
  "eslintConfig": {
    "root": true,
    "env": {
      "node": true
    },
    "extends": [
      "plugin:vue/vue3-essential",
      "eslint:recommended"
    ],
    "parserOptions": {
      "parser": "@babel/eslint-parser"
    },
    "rules": {}
  },
  "browserslist": [
    "> 1%",
    "last 2 versions",
    "not dead",
    "not ie 11"
  ]
}

你可能感兴趣的:(vue.js,前端,javascript)