当前项目为

node-vue-ele-app(服务端)

                └client(前端客户端)
  1. 安装concurrentlynpm i concurrently
  2. 进入Client文件夹,编辑package.json

    "scripts": {
     "serve": "vue-cli-service serve",
     "build": "vue-cli-service build",
    "start":"npm run serve"
      }

可通过 npm run start执行 npm run serve

  1. node-vue-ele-app文件夹的package.json中修改

      "scripts": {
     "client-install":"npm install --prefix client", //修复执行前端依赖
     "client":"npm run start --prefix client",//修复执行前端
     "start": "node server.js",//执行后端server 
     "server": "nodemon server.js",//执行后端server.js
     "dev":"concurrently \"npm run server\" \"npm run client\""//通过插件将前后端一起操作
      },

主文件夹下运行npm run dev即可一起操作前后端执行