Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build - Warning messages about missing mysql and sqlite peer #3512

Closed
jeremychone opened this issue Nov 3, 2019 · 20 comments
Closed

Build - Warning messages about missing mysql and sqlite peer #3512

jeremychone opened this issue Nov 3, 2019 · 20 comments

Comments

@jeremychone
Copy link

Environment

Knex version: 0.20.1
Database + version: Postgresql
OS: Mac, Linux

Feature discussion / request

  1. Explain what is your use case

We are using knex with Postgresql, but somehow on "npm install knex" we get the following messages:

npm WARN knex@0.20.1 requires a peer of mssql@^5.1.0 but none is installed. You must install peer dependencies yourself.
npm WARN knex@0.20.1 requires a peer of mysql@^2.17.1 but none is installed. You must install peer dependencies yourself.
npm WARN knex@0.20.1 requires a peer of mysql2@^1.7.0 but none is installed. You must install peer dependencies yourself.
npm WARN knex@0.20.1 requires a peer of sqlite3@^4.1.0 but none is installed. You must install peer dependencies yourself.

This seems to have been there since 0.20, but not sure.

We are using postgres and those are warning messages for the developers or the DevOps on the projects. Also, not sure why I am not getting similar messages for all other databases supported by Knex that I am am not using (and do not have the peer driver installed).

  1. Suggestion

I can see the value of those types of warning, but the confusion and extra noise it creates for everybody not using mysql or sqlite might not make it worthwhile.

If the decision is to keep those messages, we will have to make a documentation note for our dev / devops and hope they read or find it when they get confused about these messages. Not the end of the world, but another thing to educate dev and devops. Also, in this case, I would love to understand why we get those messages only for mysql and sqlite, and not Oracle for example, which I assume knex needs a "driver / peer package" as well.

Side Note: We are a big fan of Knex.js, so, we will respect whatever decision but just wanted to voice our point of view.

@jeremychone jeremychone changed the title Build - Warning message about missing mysql peer Build - Warning messages about missing mysql and sqlite peer Nov 3, 2019
@kibertoad
Copy link
Collaborator

@jeremychone Which version of yarn/npm are you using? I think this is related to #3081 and should be resolved by upgrading your package manager.

@jeremychone
Copy link
Author

@kibertoad npm 6.12.1, seems to be the latest.

.../ (master *)$ npm install knex
...
npm WARN knex@0.20.1 requires a peer of mssql@^5.1.0 but none is installed. You must install peer dependencies yourself.
npm WARN knex@0.20.1 requires a peer of mysql@^2.17.1 but none is installed. You must install peer dependencies yourself.
npm WARN knex@0.20.1 requires a peer of mysql2@^1.7.0 but none is installed. You must install peer dependencies yourself.
npm WARN knex@0.20.1 requires a peer of sqlite3@^4.1.0 but none is installed. You must install peer dependencies yourself.
...

+ knex@0.20.1
added 39 packages from 55 contributors and audited 3393 packages in 3.174s
found 0 vulnerabilities

.../ (master *)$ npm -v
6.12.1

@kibertoad
Copy link
Collaborator

@jeremychone Fixed upstream: npm/pacote@7a400d3

@jeremychone
Copy link
Author

@kibertoad Thank you very much for this amazing responsiveness. Will check it out in next release.

@kibertoad
Copy link
Collaborator

@jeremychone You are welcome! I've submitted PR to npm project, hopefully they'll pick it up for the next release.

@kibertoad
Copy link
Collaborator

@jeremychone Can you try again with npm 6.13.0?

@mastermatt
Copy link

I am still seeing this output on npm 6.13.0

@jeremychone
Copy link
Author

@kibertoad Sorry for the delay. As the comment above, still see it:

$ npm -v
6.13.0

$ npm install knex
npm WARN knex@0.20.1 requires a peer of mssql@^5.1.0 but none is installed. You must install peer dependencies yourself.
npm WARN knex@0.20.1 requires a peer of mysql@^2.17.1 but none is installed. You must install peer dependencies yourself.
npm WARN knex@0.20.1 requires a peer of mysql2@^1.7.0 but none is installed. You must install peer dependencies yourself.
npm WARN knex@0.20.1 requires a peer of sqlite3@^4.1.0 but none is installed. You must install peer dependencies yourself.


+ knex@0.20.1
added 39 packages from 55 contributors and audited 3426 packages in 3.231s

@kibertoad
Copy link
Collaborator

@jeremychone @mastermatt OK, it could be that it needed to be published with newer npm. Can you please try 0.20.2 and see if you still get it?

@mastermatt
Copy link

0.20.2 no longer prints the warning for me with npm 6.13.0. Thanks

@kibertoad
Copy link
Collaborator

Thank you for reporting back!

@jeremychone
Copy link
Author

jeremychone commented Nov 14, 2019

Yep, same here, knex 0.20.2 with npm 6.13.0 does not print the warnings. Thank you!!!

@kibertoad
Copy link
Collaborator

You are welcome!

@oteroleonardo
Copy link

oteroleonardo commented Sep 15, 2020

Worked for me using npm 6.14.8 also. Thank you.

@alasdairhurst
Copy link

Still seeing this on npm 6.14.8 using knex 0.21.12

@kibertoad
Copy link
Collaborator

@alasdairhurst can you check if 0.20.2 prints warnings for you?

@alasdairhurst
Copy link

0.20.2 and 0.20.15 both don't print out the warnings with the same version of npm.

@kibertoad
Copy link
Collaborator

@alasdairhurst Thanks, I'll take a look at what changed since then.

@kibertoad
Copy link
Collaborator

@alasdairhurst There shouldn't be a meaningful differences. Here are relevant sections from package.json of 0.20.15 vs 0.21.12:

  "peerDependencies": {
    "mssql": "^6.1.0",
    "mysql": "^2.18.1",
    "mysql2": "^2.1.0",
    "pg": "^7.18.2",
    "sqlite3": "^4.1.1"
  },
  "peerDependenciesMeta": {
    "mssql": {
      "optional": true
    },
    "mysql": {
      "optional": true
    },
    "mysql2": {
      "optional": true
    },
    "pg": {
      "optional": true
    },
    "sqlite3": {
      "optional": true
    }
  },
  "peerDependencies": {
    "mssql": "^6.2.1",
    "mysql": "^2.18.1",
    "mysql2": "^2.1.0",
    "pg": "^8.3.0",
    "sqlite3": "^5.0.0"
  },
  "peerDependenciesMeta": {
    "mssql": {
      "optional": true
    },
    "mysql": {
      "optional": true
    },
    "mysql2": {
      "optional": true
    },
    "pg": {
      "optional": true
    },
    "sqlite3": {
      "optional": true
    }
  },

As you can see, only versions are different, but metadata is pretty much the same. Can you share list of dependencies in your package.json and exact warning that you are getting?

@kibertoad
Copy link
Collaborator

Note the https://github.com/npm/cli/pull/1822/files -> I believe peerDependenciesMeta should suffice as per npm documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants