javascript - npm install with 2 projects in one docker image -
i have docker container combines 2 node projects one. project statsd project , project b postgres backend project writes postgres database using npm package pg. have both , b in 2 separate repos. copy them docker image separately following in dockerfile:
copy ./statsd/ /opt/statsd/ copy ./postgres-backend/ /opt/statsd/postgres-backend/
then copy javascript postgres-backend
folder /opt/statsd/backends/
inside docker. @ stage, can npm install
inside /opt/statsd
directory own package.json specification. however, postgres-backend
repo has own package.json file specifies dependencies requires (in case pg
). tried switching /opt/statsd/postgres-backend
directory , doing npm install
. installed in sub-directory. , when run statsd.js
in /opt/statsd
directory complained module pg
not found.
how can solve 1 project 2 package.json problem?
the issue app depends on specific version of pg package. find version need , run:
npm install pg@x.x --save
where x.x version app dependent on run , --save ensure dependencies updated in package.json file.
you need tell app version app dependent on. (basically)...
Comments
Post a Comment