Search code examples
javascriptnode.jsscopeexeclerna

How to set the scope flag in lerna exec?


I'm trying to run a script in lerna that would execute on all components within a specific folder.

So I'm trying to run something like

lerna --scope src/subfolder/subfolder exec -- npm run myScript

But I get this error:

Error: No packages found that match scope 'src/subfolder/subfolder'

I have tried to use different kinds of paths but none of them worked. What is the proper way of using the scope flag?


Solution

  • Normally, the scope flag should match your repo name in package.json

    In your case, it seems that you should register your script folder as a package of your repo, then you can run your script in that package.