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

278
Views
Lerna error: cannot find module during CI build

I have a monorepo using Lerna that I trying to build with Gitlab CI. Running lerna run build locally builds everything successfully.

The Dockerfile that Gitlab tries to execute looks a bit like this:

FROM node:16 AS common
WORKDIR /usr/src/app
RUN yarn global add lerna
COPY . . 

RUN lerna bootstrap --include-dependencies
RUN lerna link

RUN yarn

# yarn build === lerna run build
RUN yarn build

Which results in the following errors:

Cannot find module '@project/common' or its corresponding type declarations.
import { SomeClass } from '@project/common';

Is there any step I am missing? Thanks in advance!

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

I was able to fix this issue by changing the Dockerfile. Running yarn before running lerna bootstrap and removing yarn build resolved the errors.

My Dockerfile now looks like this:

FROM node:16 AS common
WORKDIR /usr/src/app
RUN yarn global add lerna
COPY . . 

RUN yarn
RUN lerna bootstrap --include-dependencies

I can definitely attribute the errors to my limited knowledge of Lerna, but I hope this answer can still help others with similar issues.

about 4 years ago · Juan Pablo Isaza Report

0

What version of lerna is being used locally? Amend your question to include the output of learna info.

yarn global add learna will install the latest version, which currently is v4.0.0.

about 4 years ago · Juan Pablo Isaza Report
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!