Launch node.js app from subdirectory (monorepo)

0

I have a monorepo with various shared assets folders and a node.js "webapp" folder.

How can I use the "/webapp" directory and its package.json to launch?

I added a Procfile to the root directory with the following:

web: cd webapp && npm start

This now errors with:

----------------------------------------
/var/log/web.stdout.log
----------------------------------------
Aug 27 00:26:39 ip-10-185-211-24 web: > Elastic-Beanstalk-Sample-App@0.0.1 start /var/app/current
Aug 27 00:26:39 ip-10-185-211-24 web: > node app.js
Aug 27 00:26:39 ip-10-185-211-24 web: Server running at http://127.0.0.1:8080/
Aug 27 00:36:51 ip-10-185-211-24 web: npm ERR! missing script: start
Aug 27 00:36:51 ip-10-185-211-24 web: npm ERR! A complete log of this run can be found in:
Aug 27 00:36:51 ip-10-185-211-24 web: npm ERR!     /home/webapp/.npm/_logs/2020-08-27T00_36_51_197Z-debug.log

The package.json has a start key so I assume its not using the correct package.json.

wonka
已提問 4 年前檢視次數 577 次
1 個回答
0

The solution was to add a Procfile to the root directory with the following:

web: cd webapp && npm start
wonka
已回答 4 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南