[Bug?]: Running lerna commands inside individual packages in a monorepo throws error with lerna.json
not exist
#6602
Labels
bug
Something isn't working
Self-service
Describe the bug
I have a monorepo setup where if I am trying to run
npx lerna run build
.There are 2 scenarios:
npx lerna run build
from root level directory of my repo, it works fine (it runs build for all packages)cd packages/package-a
and try to runnpx lerna run build
, it does not run build for all packages. Instead, it throws error as below:Caution
lerna notice cli v8.1.9
lerna ERR! ENOLERNA
lerna.json
does not exist, have you runlerna init
?I have lerna.json at root level directory only and it's contents are given below:
Note
Note: It was working fine when I was using yarn 1.22.21 and used to run build for all packages when I used npx lerna run build inside individual package but this issue is coming after I switched to yarn 4.4.1. One more thing to add here is that if I add lerna.json inside the individual package, then it starts working. But IMO, it should work with just root level lerna.json config only as it used to work with yarn v1.22.21.
Can someone help to investigate why is this happening? Thanks
node: 18.18.0
yarn: 4.4.1
lerna: 8.1.9
To reproduce
Environment
Additional context
If I already added
"packages": ["packages/*"]
in my root level lerna.json, then it should have worked inside individual packages also as it used to work with yarn v1.22.21The text was updated successfully, but these errors were encountered: