Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

1.1K
Views
yarn: install local package from monorepo and use it inside docker image with offline cache

My folder structure looks like this (monorepo):

project
|
+--- /api
|    |
|    +--- /.offline-cache
|    +--- /src
|    |    +--- index.js
|    |    +--- ...
|    |
|    +--- Dockerfile
|    +--- package.json
|    +--- yarn.lock
|
+--- /common
|    |
|    +--- /src
|    |    +--- index.js
|    |
|    +--- package.json
|
+--- /ui
|    |
|    +--- /.offline-cache
|    +--- /src
|    |    +--- index.js
|    |    +--- ...
|    |
|    +--- Dockerfile
|    +--- package.json
|    +--- yarn.lock
|
+--- docker-compose.yml

The offline-cache and building the docker-images for every 'service' (ui, api) are working.

Now I want to access/install the common module inside api and ui as well.
Running yarn add ./../common inside /api works and installs the module inside the api folder and adds it to package.json and yarn.lock file. But when I try to rebuild the docker-image I get an error telling me

error Package "" refers to a non-existing file '"/common"'.

that's because there is no common folder inside the docker container and the installed package isn't added to the offline-mirror :(

I can't copy the common folder to the docker-image because it is outside the build context and I don't want to publish to NPM. What else can I do to get this working?

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!