我在
package.json
上添加了脚本:
yarn build
yarn serve
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"
}
}
您需要在
yarn build && yarn serve
中添加第二个“&”
同时 npm install -g
“start”:“同时“纱线构建”“纱线服务””