lerna: Bootstrap with yarn fails (the first time) when run as an npm script

Running the following command as an npm script:

lerna bootstrap --hoist --loglevel=silly --nohoist='{joi,webpack}'"

I get the following error:

NpmUtilities.installInDir     (".", ["babel-plugin-external-helpers@6.22.0","babel-preset-es2015@6.18.0","babel-preset-stage-2@6.18...)
Command exited with status 1: npm install
Errored while running BootstrapCommand.execute
Command exited with status 1: npm install

The log files are unhelpful. They basically just say that some error occurred when installing hoisted dependencies to the root as well as the non-hoisted dependencies to the various package directories.

I don’t get this error the second time I run the command or if I don’t run it as an npm script.

Do the lerna commands need to be executed by the global lerna CLI tool?

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 5
  • Comments: 29 (9 by maintainers)

Most upvoted comments

just an update… because of this issue ive had to abandon using yarn with lerna all together… Hoping this can be resolved

Any update on this issue?

@noherczeg interesting- I only see this when running on CircleCI, which is Dockerized. I’m guessing this has something to do with the issue.

This is also going on in our case, but only in a Dockerized container where the user is root. Could that have anything to do with this?

Seems to be related when yarn install in a particular package produces warnings. Is that intended @evocateur?

@hulkish any luck? I seem to be having the same issue as you 😕

@medunham this hits close to home, ill give it a shot and report back, thanks!

This may be related.

I have a command like "bootstrap": "lerna bootstrap" in my package.json at the root of the project and when I run npm run lerna from the command line I get similar errors with packages that have private scopes and custom .npmrc files in packages/some-project/.npmrc.

If I manually hoist the .npmrc file from packages/some-project/.npmrc to the root of the project, the npm run bootstrap then succeeds.

If I run the globally installed lerna boostrap command, I get the same error unless I hoist the .npmrc file manually.

If I rollback from 2.0.0-beta.37 to 2.0.0-beta.36 without the hoisted .npmrc the lerna bootstrap command still fails so it doesn’t seem to be something introduced from .36 to .37.