npm-installyarnpkglerna

lerna add : No packages found where <package> can be added


have added lerna to my project, i have added a package to my server by running this command successfully:

 lerna add  @types/express --dev

But when I want to add another one:

lerna add graphql class-validator type-graphql

I got this error :

info cli using local version of lerna
lerna notice cli v3.22.1
lerna WARN No packages found where graphql can be added. 
  1. Is something missed or wrong for adding the packages?
  2. Should I use yarn add instead of leran add? looks it works but I doubt about the packages tree form to be correct

Solution

  • At the moment, lerna doesn't support adding multiple packages to another package like so:

    āŒ lerna add '@my-company/{utils,types}' --scope '@my-company/ui' 
    
    // We have to do this instead
    lerna add '@my-company/utils' --scope '@my-company/ui' 
    lerna add '@my-company/types' --scope '@my-company/ui'
    

    Lerna does support adding 1 package into multiple packages though:

    lerna add '@my-company/utils --scope '@my-company/{ui,data}'   
    

    lerna's github discussion on this issue for updates (link)