mesaugat / express-api-es6-starter

Build APIs with Express.js in no time using ES6/ES7/ESNext goodness.

Home Page:https://express-api-es6-starter.herokuapp.com/api-docs/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

docker => 'client' is missing

duard opened this issue · comments

When I try to run it from docker I get
api_1 | Error: knex: Required configuration option 'client' is missing.

api_1  | [4/5] Linking dependencies...
api_1  | [5/5] Building fresh packages...
api_1  | success Saved 1 new dependency.
api_1  | info Direct dependencies
api_1  | └─ mysql@2.15.0
api_1  | info All dependencies
api_1  | └─ mysql@2.15.0
api_1  | Done in 11.15s.
api_1  | yarn run v1.6.0
api_1  | $ nodemon --watch .env --watch src --exec babel-node src --source-maps
api_1  | [nodemon] 1.12.1
api_1  | [nodemon] to restart at any time, enter `rs`
api_1  | [nodemon] watching: /app/.env/**/* /app/src/**/*
api_1  | [nodemon] starting `babel-node src --source-maps`
api_1  | /app/node_modules/knex/lib/client.js:108
api_1  |     throw new Error('knex: Required configuration option \'client\' is missing.');
api_1  |     ^
api_1  |
api_1  | Error: knex: Required configuration option 'client' is missing.
api_1  |     at new Client (/app/node_modules/knex/lib/client.js:108:11)
api_1  |     at Knex (/app/node_modules/knex/lib/index.js:60:34)
api_1  |     at Object.<anonymous> (/app/src/db.js:8:14)
api_1  |     at Module._compile (module.js:652:30)
api_1  |     at loader (/app/node_modules/babel-register/lib/node.js:144:5)
api_1  |     at Object.require.extensions.(anonymous function) [as .js] (/app/node_modules/babel-register/lib/node.js:154:7)
api_1  |     at Module.load (module.js:565:32)
api_1  |     at tryModuleLoad (module.js:505:12)
api_1  |     at Function.Module._load (module.js:497:3)
api_1  |     at Module.require (module.js:596:17)
api_1  |     at require (internal/module.js:11:18)
api_1  |     at Object.<anonymous> (/app/src/index.js:2:1)
api_1  |     at Module._compile (module.js:652:30)
api_1  |     at loader (/app/node_modules/babel-register/lib/node.js:144:5)
api_1  |     at Object.require.extensions.(anonymous function) [as .js] (/app/node_modules/babel-register/lib/node.js:154:7)
api_1  |     at Module.load (module.js:565:32)

Set your client in .env.docker
https://github.com/mesaugat/express-api-es6-starter/blob/master/.env.docker#L12

Looks like you are using mysql.

DB_CLIENT='mysql'
DB_PORT='3306'

Also make sure you have .env inside your docker container which is synced from .env.docker

express-api-es6-starter_1 | yarn run v1.5.1
express-api-es6-starter_1 | $ nodemon --watch .env --watch src --exec babel-node src --source-maps
express-api-es6-starter_1 | sh: nodemon: not found
express-api-es6-starter_1 | error An unexpected error occurred: "Command failed.
express-api-es6-starter_1 | Exit code: 127
express-api-es6-starter_1 | Command: sh
express-api-es6-starter_1 | Arguments: -c nodemon --watch .env --watch src --exec babel-node src --source-maps
express-api-es6-starter_1 | Directory: /app
express-api-es6-starter_1 | Output:
express-api-es6-starter_1 | ".
express-api-es6-starter_1 | info If you think this is a bug, please open a bug report with the information provided in "/app/yarn-error.log".
express-api-es6-starter_1 | info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
dock1_express-api-es6-starter_1 exited with code 1