如何使用 NPM 脚本 run/start json-server 和 live-server 在 package.json 中启动?

How Can I run/start json-server and live-server using NPM scripts start in package.json?

我有一个包含 html/css/javascript 个文件的项目,我想输入命令 npm start 到 运行 json-server and live-server.

我试过这个命令:"start": "json-server --watch db.json && live-server",但它只启动第一个命令,而不是两个。

package.json

{
  "name": "testa-npm-live-server",
  "version": "1.0.0",
  "description": "",
  "main": "",
  "dependencies": {},
  "devDependencies": {
    "json-server": "^0.16.1",
    "live-server": "^1.2.1"
  },
  "scripts": {
    "start": "json-server --watch db.json && live-server"
  },
  "author": "",
  "license": "ISC"
}

IDE: vscode
节点版本:v12.18.1
NPM 版本:6.14.5

并行中使用concurrently到运行命令。 && 运行s in serial/sequential 即第二个命令仅在第一个命令完成后开始 运行ning.

{
  "name": "testa-npm-live-server",
  "version": "1.0.0",
  "description": "",
  "main": "",
  "dependencies": {},
  "devDependencies": {
    "concurrently": "^5.2.0",
    "json-server": "^0.16.1",
    "live-server": "^1.2.1"
  },
  "scripts": {
    "start": "concurrently \"json-server --watch db.json\" \"live-server\""
  },
  "author": "",
  "license": "ISC"
}

非常感谢 NodeSchool Campinas 社区的帮助:)