package.json 上的 React JS 脚本无法纱线多个脚本

问题描述 投票:0回答:2

我在

package.json
上添加了脚本:

  1. yarn build
  2. yarn serve
  3. yarn start
    (运行
    yarn build
    yarn serve

但是问题是当我运行

yarn start
时,终端无法运行
yarn serve
,但是
yarn build
成功运行了:

当我单独运行它们时,两者都在工作:

 {
  "dependencies": {
    "@babel/cli": "^7.17.10",
    "@babel/core": "^7.18.2",
    "@babel/preset-env": "^7.18.2",
    "@babel/preset-react": "^7.17.12",
    "lite-server": "^2.6.1"
  },
  "scripts": {
    "build": "babel src --out-dir public -w",
    "serve": "lite-server --baseDir public",
    "start": "yarn build & yarn serve"
  }
}
reactjs yarnpkg
2个回答
0
投票

您需要在

yarn build && yarn serve

中添加第二个“&”

0
投票
  1. 同时安装

同时 npm install -g

  1. 使用此命令创建脚本

“start”:“同时“纱线构建”“纱线服务””

© www.soinside.com 2019 - 2024. All rights reserved.