Yarn: The package undefined@undefined requires a flat dependency graph

Created on 24 Aug 2017  路  7Comments  路  Source: yarnpkg/yarn

If you run yarn add [email protected] in an empty folder, the output is

yarn add v0.28.4
info No lockfile found.
[1/4] 馃攳  Resolving packages...
error The package undefined@undefined requires a flat dependency graph. Add `"flat": true` to your package.json and try again.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

The same happens with yarn 0.27.5. Tested on macOS Sierra

npm install [email protected] works fine

Most helpful comment

Same here, but with polymer-cli.

All 7 comments

yarn add [email protected] also works

The cause seems to be that 6.1.2 depends on @polymer/test-fixture 3.0.0-pre.1, which defines "flat": true. The error message is a bit... uninformative

Same here, but with polymer-cli.

Is this still happening with more recent versions of Yarn?

This is still happening with yarn 1.3.2 with @polymer/app-layout

I'm also getting this with yarn 1.3.2. Not sure what exactly is causing it though (I suspect Polymer) how can I track that down?

I found the cause of this issue, the error message flatGlobalError expects two arguments for package name and version, but they aren't being passed. It's on line 39167 of cli.js, just change this.reporter.lang('flatGlobalError') to this.reporter.lang('flatGlobalError', info.name, info.version).

I'm working on a patch now.

Was this page helpful?
0 / 5 - 0 ratings