我需要部署不在项目根目录中的节点应用程序。
我的项目与此类似:https : //github.com/graphql-boilerplates/react-fullstack-graphql/tree/master/advanced
该项目的根源是一个React应用程序,但我不想部署它。在名为“服务器”的文件夹中,有我的节点服务器,这就是我需要部署到Heroku的服务器。
当我部署Heroku时,它似乎npm run start
在顶级package.json上运行。我怎样才能让Heroku忽略这一点,而只运行/server
文件夹中的package.json ?
更新:Ive在我的项目根目录中使用以下命令创建了一个Procfile:
web: ./server npm run start
但是当我部署时,出现应用程序错误:
2018-07-05T12:41:51.627168+00:00 app[api]: Release v4 created by user [email protected]
2018-07-05T12:41:59.000000+00:00 app[api]: Build succeeded
2018-07-05T12:42:02.176695+00:00 heroku[web.1]: Starting process with command `./server npm run start`
2018-07-05T12:42:04.817337+00:00 heroku[web.1]: State changed from starting to crashed
2018-07-05T12:42:04.701159+00:00 app[web.1]: bash: ./server: Is a directory
2018-07-05T12:42:04.782252+00:00 heroku[web.1]: Process exited with status 126
2018-07-05T12:42:11.974345+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=DEPLOY-NAME.herokuapp.com request_id=c2cba42e-80af-4b16-95sdfdfd-2918 fwd="86.343.251.15" dyno= connect= service= status=503 bytes= protocol=https
您可以通过定义一个改变这种行为Procfile
,它覆盖start
:https://devcenter.heroku.com/articles/nodejs-support#default-web-process-type
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句