【发布时间】:2019-11-28 14:48:34
【问题描述】:
我正在尝试部署我的小型全栈应用程序。文件结构是这样的。我使用的是节点服务器,客户端文件夹是由 create-react-app 创建的。
\MyApp
\server.js
\package.json
\client
\package.json
我的外部 package.json 脚本如下所示:
"scripts": {
"client": "cd client && yarn start",
"server": "nodemon server.js",
"dev": "concurrently --kill-others-on-fail \"yarn server\" \"yarn
client\"",
"dev:server": "cd client && yarn build && cd .. && yarn start",
"start": "node server.js",
"heroku-postbuild": "cd client && yarn install && yarn install --
only=dev --no-shrinkwrap && yarn run build"
},
我的客户端 package.json 脚本如下所示:
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
但是当我尝试在 heroku 上部署我的应用时,它会引发以下错误:
warning package.json: No license field
error Command "build" not found.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation
about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation
about this command.
-----> Build failed
We're sorry this build is failing! You can troubleshoot common .
issues here:
https://devcenter.heroku.com/articles/troubleshooting-node-deploys
If you're stuck, please submit a ticket so we can help:
https://help.heroku.com/
Love,
Heroku
! Push rejected, failed to compile Node.js app.
! Push failed
我不明白我在这里做错了什么。
【问题讨论】:
-
感谢您提出这个问题????
标签: node.js reactjs heroku deployment create-react-app