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
gefragt vor 4 Jahren577 Aufrufe
1 Antwort
0

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

web: cd webapp && npm start
wonka
beantwortet vor 4 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen