bookshelf: bookshelf@1.2.0" has incorrect peer dependency "knex@>=0.15.0 <0.22.0"

  • Related Issues: #IssueNumber if necessary

Introduction

I did a yarn add knex, followed by yarn add bookshelf, and got this warning message:

bookshelf@1.2.0" has incorrect peer dependency "knex@>=0.15.0 <0.22.0"

Issue Description

Whenever yarn is ran, I’ll get:

bookshelf@1.2.0" has incorrect peer dependency "knex@>=0.15.0 <0.22.0"

Steps to reproduce issue

yarn add knex
yarn add bookshelf

Expected behaviour

No warning message

Actual behaviour

Gotten the warning message bookshelf@1.2.0" has incorrect peer dependency "knex@>=0.15.0 <0.22.0"

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 15
  • Comments: 23 (6 by maintainers)

Most upvoted comments

This is not a viable solution. The best part is to have a bookshelf upgrade with correct peer dependencies versions.

We are using knex 0.95.11 with Bookshelf 1.2.0 and it works fine. Can we just correct the package.json to support higher versions?

I found workaround based on npm docs

we can ignore the peer dependency by adding --legacy-peer-deps so we can install bookshelf with

npm i bookshelf --legacy-peer-deps

or

yarn add bookshelf --legacy-peer-deps

The package.json file of Bookshelf on npm website has a peer dependency for knex i.e. it’s version should lay between >=0.15.0 <0.22.0. I downgraded knex to 0.21.19 version and the error was solved. This is the only solution I guess.

Any possibility of getting this resolved? I too am using the latest version of Knex (at this time, 0.95.14) with Bookshelf 1.2.0 just fine. Using the --legacy-peer-deps will skip peerDependencies (and --force will obviously force the issue), but using those flags long-term in my opinion is not ideal.

I agree. I finally started seeing high vulnerabilities warnings with npm audit.

any news?

@kibertoad Yeah absolutely! Sorry, I made the comment and had to move on at the time. Thanks for the reminder.