dresende / node-orm2

Object Relational Mapping
http://github.com/dresende/node-orm2
MIT License
3.07k stars 379 forks source link

can't connect using mysql #783

Closed stukennedy closed 7 years ago

stukennedy commented 7 years ago

When I attempt to connect I get the following error

db connect { 
  [ORMError: Connection protocol not supported - have you installed the database driver for mysql?]
  message: 'Connection protocol not supported - have you installed the database driver for mysql?',
  code: 4,
  literalCode: 'NO_SUPPORT' 
}

However I've installed the correct driver using

npm install --save mysql@2.0.0-alpha9

Here's my dependencies from package.json

  "dependencies": {
    "eyes": "^0.1.8",
    "lodash": "^4.16.6",
    "moment": "^2.12.0",
    "money": "^0.2.0",
    "mysql": "2.0.0-alpha9",
    "orm": "^3.2.3"
  },

I've tried uninstalling everything and reinstalling all the npm modules, same issue. I'm running this using AWS serverless. Before installing ORM, I was successfully calling this same DB using the mysql module directly.

stukennedy commented 7 years ago

managed to fix it locally, but not on serverless When I installed the latest version of mysql it started working localled. i.e. don't use mysql@2.0.0-alpha9 as recommended in the wiki

I'm still getting the same error on the server.

dxg commented 7 years ago

I've updated the wiki to use the same versions as in devDependencies in package.json. Does that work for you?

stukennedy commented 7 years ago

that's great ... I also just figured out my issue. I'm using Webpack to build, and ORM uses mysql driver implicitly. So, I need to import 'mysql' in my source for Webpack to include it in the build. It's installed globally on my local machine when testing, which is why it works there.