package react js脚本。
我在package.json
上的
- 脚本
- 上
- 添加构建和
纱线服务
),
但问题是当我运行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"
}
}
I added on scripts on package.json
:
yarn build
yarn serve
yarn start
(to runyarn build
andyarn serve
)
But the problem is when I run yarn start
, the terminal cannot run yarn serve
but yarn build
is successfully running:
When I run them separately, both are working:
{
"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"
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要添加第二个“&”在
纱构建& amp;纱线服务
You need to add a second "&" in
yarn build && yarn serve
npm install -g同时
使用此命令
“ start”:“同时\” yarn build \“ \” yarn serve \“
”npm install -g concurrently
"start": "concurrently \"yarn build\" \"yarn serve\""