sysgears / apollo-universal-starter-kit

Apollo Universal Starter Kit is a SEO-friendly, fully-configured, modular starter application that helps developers to streamline web, server, and mobile development with cutting-edge technologies and ultimate code reuse.
https://apollokit.org
MIT License
1.68k stars 323 forks source link

Mysql module not added in correct yarn workspace. Error in yarn seed. #1184

Open CR1AT0RS opened 4 years ago

CR1AT0RS commented 4 years ago

Describe the bug Yarn seed with DB_CLIENT=mysql fails.

To Reproduce Steps to reproduce the behavior:

  1. git clone the repo
  2. change the DB_Client=mysql in .env file and set socket, user, pass etc.
  3. yarn
  4. yarn seed

Expected behavior knex data migration completed succesfully

Log lerna notice cli v3.16.4 lerna info versioning independent lerna info filter [ 'server' ] lerna info Executing command in 1 package: "yarn run seed" server: $ yarn migrate && knex seed:run server: $ knex migrate:latest server: Using environment: development server: Knex: run server: $ npm install mysql --save server: Error: Cannot find module 'mysql' server: at Module._resolveFilename (internal/modules/cjs/loader.js:636:15) server: at Function.realResolve [as _resolveFilename] (/Users/narya/Documents/proj1/lerna-proj/apollo-universal-starter-kit/modules/database/server-ts/knexdata.js:27:20) server: at Function.Module._load (internal/modules/cjs/loader.js:562:25) server: at Module.require (internal/modules/cjs/loader.js:692:17) server: at require (internal/modules/cjs/helpers.js:25:18) server: at Client_MySQL._driver (/Users/narya/Documents/proj1/lerna-proj/apollo-universal-starter-kit/node_modules/knex/lib/dialects/mysql/index.js:73:12) server: at Client_MySQL.initializeDriver (/Users/narya/Documents/proj1/lerna-proj/apollo-universal-starter-kit/node_modules/knex/lib/client.js:254:26) server: at Client_MySQL.Client (/Users/narya/Documents/proj1/lerna-proj/apollo-universal-starter-kit/node_modules/knex/lib/client.js:115:10) server: at new Client_MySQL (/Users/narya/Documents/proj1/lerna-proj/apollo-universal-starter-kit/node_modules/knex/lib/dialects/mysql/index.js:62:20) server: at Knex (/Users/narya/Documents/proj1/lerna-proj/apollo-universal-starter-kit/node_modules/knex/lib/index.js:60:34) server: at initKnex (/Users/narya/Documents/proj1/lerna-proj/apollo-universal-starter-kit/node_modules/knex/bin/cli.js:69:10) server: at Command.<anonymous> (/Users/narya/Documents/proj1/lerna-proj/apollo-universal-starter-kit/node_modules/knex/bin/cli.js:127:17) server: at Command.listener (/Users/narya/Documents/proj1/lerna-proj/apollo-universal-starter-kit/node_modules/commander/index.js:315:8) server: at Command.emit (events.js:198:13) server: at Command.parseArgs (/Users/narya/Documents/proj1/lerna-proj/apollo-universal-starter-kit/node_modules/commander/index.js:651:12) server: at Command.parse (/Users/narya/Documents/proj1/lerna-proj/apollo-universal-starter-kit/node_modules/commander/index.js:474:21) server: error Command failed with exit code 1. server: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. server: error Command failed with exit code 1. server: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. lerna ERR! yarn run seed exited 1 in 'server' error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Desktop (please complete the following information):

Question

I cam add mysql module via

  1. Yarn add mysql error Running this command will add the dependency to the workspace root rather than the workspace itself, which might not be what you want - if you really meant it, make it explicit by running this command again with the -W flag (or --ignore-workspace-root-check). info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

  2. But I think this module should be loaded already. Also if it needs manual additional which yarn workspace should I add it under?

CR1AT0RS commented 4 years ago

After adding package in server workspace via lerna:

  1. Adding the package with this command lerna add mysql packages/server
  2. Run yarn && yarn seed lerna notice cli v3.16.4 lerna info versioning independent lerna info filter [ 'server' ] lerna info Executing command in 1 package: "yarn run seed" server: $ yarn migrate && knex seed:run server: $ knex migrate:latest server: Using environment: development server: TypeError: Unknown SSL profile ' ' server: at Function.getSSLProfile (/Users/narya/Documents/proj1/lerna-proj/apollo-universal-starter-kit/node_modules/mysql/lib/ConnectionConfig.js:141:11) server: at new ConnectionConfig (/Users/narya/Documents/proj1/lerna-proj/apollo-universal-starter-kit/node_modules/mysql/lib/ConnectionConfig.js:34:24) server: at Object.createConnection (/Users/narya/Documents/proj1/lerna-proj/apollo-universal-starter-kit/node_modules/mysql/index.js:13:34) server: at /Users/narya/Documents/proj1/lerna-proj/apollo-universal-starter-kit/node_modules/knex/lib/dialects/mysql/index.js:105:37 server: at Promise._execute (/Users/narya/Documents/proj1/lerna-proj/apollo-universal-starter-kit/node_modules/bluebird/js/release/debuggability.js:313:9) server: at Promise._resolveFromExecutor (/Users/narya/Documents/proj1/lerna-proj/apollo-universal-starter-kit/node_modules/bluebird/js/release/promise.js:488:18) server: at new Promise (/Users/narya/Documents/proj1/lerna-proj/apollo-universal-starter-kit/node_modules/bluebird/js/release/promise.js:79:10) server: at Client_MySQL.acquireRawConnection (/Users/narya/Documents/proj1/lerna-proj/apollo-universal-starter-kit/node_modules/knex/lib/dialects/mysql/index.js:104:12) server: at create (/Users/narya/Documents/proj1/lerna-proj/apollo-universal-starter-kit/node_modules/knex/lib/client.js:283:23) server: at utils_1.tryPromise (/Users/narya/Documents/proj1/lerna-proj/apollo-universal-starter-kit/node_modules/tarn/lib/Pool.js:315:34) server: at Object.tryPromise (/Users/narya/Documents/proj1/lerna-proj/apollo-universal-starter-kit/node_modules/tarn/lib/utils.js:53:24) server: at Promise (/Users/narya/Documents/proj1/lerna-proj/apollo-universal-starter-kit/node_modules/tarn/lib/Pool.js:315:17) server: at new Promise (<anonymous>) server: at callbackOrPromise (/Users/narya/Documents/proj1/lerna-proj/apollo-universal-starter-kit/node_modules/tarn/lib/Pool.js:306:12) server: at Pool._create (/Users/narya/Documents/proj1/lerna-proj/apollo-universal-starter-kit/node_modules/tarn/lib/Pool.js:236:9) server: at Pool._doCreate (/Users/narya/Documents/proj1/lerna-proj/apollo-universal-starter-kit/node_modules/tarn/lib/Pool.js:208:36) server: error Command failed with exit code 1. server: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. server: error Command failed with exit code 1. server: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. lerna ERR! yarn run seed exited 1 in 'server' error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.