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
asked 4 years ago568 views
1 Answer
0

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

web: cd webapp && npm start
wonka
answered 4 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions