Bugsnag-js: @bugsnag/plugin-react unmet peer dependency

Created on 29 Nov 2018  ·  13Comments  ·  Source: bugsnag/bugsnag-js

Installing the new v5 of Bugsnag by following the instructions on https://docs.bugsnag.com/platforms/javascript/react/ results in the following warning on the console:

warning " > @bugsnag/[email protected]" has unmet peer dependency "@bugsnag/browser@* || >=5.0.0-rc.1".

It's only a warning but suggest either making @bugsnag/browser a dependency or add it to the installation instructions if it's actually required.

Most helpful comment

I agree it could be confusing. Thanks for bringing it up 🙏

@bugsnag/browser _is_ installed as a dependency of @bugsnag/js, so it shouldn't complain after it's resolved everything. I'll get this looked into.

All 13 comments

Thanks for the report. Is this using yarn or npm? And which version?

We want to make it clear that @bugsnag/plugin-react etc. need to be installed alongside @bugsnag/js or @bugsnag/browser, but it could be that this expression is not quite right.

It is definitely a peer dependency though.

@bengourley I'm using yarn 1.12.3

I was installing it alongside @bugsnag/js but it still throws the warning about @bugsnag/browser. Note this doesn't seem to cause any errors but could be confusing for folks.

I agree it could be confusing. Thanks for bringing it up 🙏

@bugsnag/browser _is_ installed as a dependency of @bugsnag/js, so it shouldn't complain after it's resolved everything. I'll get this looked into.

I imagine it doesnt pick up transitive dependencies so you'd have to have a peer on js.

I have this versions and packages at my package.json dependencies section:

"@bugsnag/js": "^5.1.0",
"@bugsnag/plugin-vue": "^5.1.0",

And I have the same warning:

[3/4] Linking dependencies...
warning " > @bugsnag/[email protected]" has unmet peer dependency "@bugsnag/browser@* || >=5.0.0-rc.1".

I'm using Yarn 1.12.3

After

yarn add @bugsnag/js @bugsnag/plugin-react

I also have this warning:

@bugsnag/[email protected]" has unmet peer dependency "@bugsnag/browser@* || >=5.0.0-rc.1".

I use Yarn v1.12.1.

Why is alpha version being installed by default? I expect stable release.

@anikolaev there was a short period of time where the v6.0.0-alpha.1 versions had the "latest" dist tag on npm, which was resolved. The latest "stable" dist tag is v5.2.0.

Yarn will give you the peer dep warnings, but npm won't.

@bengourley I am reinstalling it right now and it still installs @bugsnag/[email protected]

Direct dependencies
  @bugsnag/[email protected]
  @bugsnag/[email protected]

Ah, apologies! I've updated the dist-tags for the plugins now too.

Great, it installs 5.2.0 now. But the original issue is still reproducable:

warning " > @bugsnag/[email protected]" has unmet peer dependency "@bugsnag/browser@* || >=5.0.0-rc.1".

This also happens for express. We have

    "@bugsnag/js": "^5.2.0",
    "@bugsnag/plugin-express": "^5.2.0",
    "@bugsnag/plugin-react": "^5.2.0",

and get on yarn install:

warning " > @bugsnag/[email protected]" has unmet peer dependency "@bugsnag/node@* || >=5.0.0-alpha.0".
warning " > @bugsnag/[email protected]" has unmet peer dependency "@bugsnag/browser@* || >=5.0.0-rc.1".

Yeah it's a difference in behaviour between yarn and npm. It will be the same for any of our plugins currently, as the dependency tree looks like this:

@bugsnag/js
├── @bugsnag/node
└── @bugsnag/browser
@bugsnag/react
└── @bugsnag/browser (peer dep)

npm resolves the tree and then emits any warnings (so is silent, because the peer dependency is satisfied) but yarn does it from looking either at the manifest or just the top level dependencies.

The solution is to make the plugins just depend on the "universal" shim package @bugsnag/js rather than the platform specific notifier and we'll get to it at some point in the near future!

This was fixed in #480 and will go out with v6.0.0 in the next few weeks.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

killia15 picture killia15  ·  6Comments

vikrantnegi picture vikrantnegi  ·  5Comments

darkyndy picture darkyndy  ·  4Comments

foxyblocks picture foxyblocks  ·  5Comments

H2go picture H2go  ·  5Comments