Open Randy85253 opened 7 years ago
The problem is that knex.js expects something like that for sqlite3.
var knex = require('knex')({
client: 'sqlite3',
connection: {
filename: "./mydb.sqlite"
}
});
So you have to change the ./src/core/Database.ts for that.
You also need to upgrade the "ts-node" package.
I've upgraded everything in package.json and I'm able to build & serve (yarn upgrade --latest
).
Looks like a great project, but can't see all its goodness cause it won't build for me
No MySql, so trying 'sqlite3'. Just setting the connection string to be a file name. But I am not sure that is my problem, since it fails to even run the db:migrate script. Seems like a Knex issue.
With src/config.js
connection: 'mydb.sqlite', client: 'sqlite3',
and entering 'npm run db:migrate', i get this error0 info it worked if it ends with ok 1 verbose cli [ 'C:\Program Files\nodejs\node.exe', 1 verbose cli 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js', 1 verbose cli 'run', 1 verbose cli 'db:migrate' ] 2 info using npm@4.2.0 3 info using node@v7.10.0 4 verbose run-script [ 'predb:migrate', 'db:migrate', 'postdb:migrate' ] 5 info lifecycle express-graphql-typescript-boilerplate@1.0.0-rc.3~predb:migrate: express-graphql-typescript-boilerplate@1.0.0-rc.3 6 silly lifecycle express-graphql-typescript-boilerplate@1.0.0-rc.3~predb:migrate: no script for predb:migrate, continuing 7 info lifecycle express-graphql-typescript-boilerplate@1.0.0-rc.3~db:migrate: express-graphql-typescript-boilerplate@1.0.0-rc.3 8 verbose lifecycle express-graphql-typescript-boilerplate@1.0.0-rc.3~db:migrate: unsafe-perm in lifecycle true 9 verbose lifecycle express-graphql-typescript-boilerplate@1.0.0-rc.3~db:migrate: PATH: C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;C:\Dev\Play\graphQL\express-graphql-typescript-boilerplate-master\node_modules.bin;C:\ProgramData\Oracle\Java\javapath;C:\Program Files\Docker\Docker\Resources\bin;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Users\Randy.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\PuTTY\;C:\Program Files\Git\cmd;C:\Program Files\nodejs\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Users\Randy\AppData\Local\Microsoft\WindowsApps;C:\Dev\Libs\Python;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Users\Randy\AppData\Local\GitHub\PortableGit_f02737a78695063deace08e96d5042710d3e32db\cmd;C:\Program Files\MongoDB\Server\3.4\bin;C:\Program Files\MySQL\MySQL Server 5.7\bin;C:\Users\Randy\AppData\Roaming\npm; 10 verbose lifecycle express-graphql-typescript-boilerplate@1.0.0-rc.3~db:migrate: CWD: C:\Dev\Play\graphQL\express-graphql-typescript-boilerplate-master 11 silly lifecycle express-graphql-typescript-boilerplate@1.0.0-rc.3~db:migrate: Args: [ '/d /s /c', 'knex migrate:latest' ] 12 silly lifecycle express-graphql-typescript-boilerplate@1.0.0-rc.3~db:migrate: Returned: code: 1 signal: null 13 info lifecycle express-graphql-typescript-boilerplate@1.0.0-rc.3~db:migrate: Failed to exec db:migrate script 14 verbose stack Error: express-graphql-typescript-boilerplate@1.0.0-rc.3 db:migrate: (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:279:16)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at EventEmitter.emit (events.js:194:7)
14 verbose stack at ChildProcess. (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:40:14)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at ChildProcess.emit (events.js:194:7)
14 verbose stack at maybeClose (internal/child_process.js:899:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid express-graphql-typescript-boilerplate@1.0.0-rc.3
16 verbose cwd C:\Dev\Play\graphQL\express-graphql-typescript-boilerplate-master
17 error Windows_NT 10.0.15063
18 error argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "run" "db:migrate"
19 error node v7.10.0
20 error npm v4.2.0
21 error code ELIFECYCLE
22 error errno 1
23 error express-graphql-typescript-boilerplate@1.0.0-rc.3 db:migrate:
knex migrate:latest
14 verbose stack Exit status 1 14 verbose stack at EventEmitter.knex migrate:latest
23 error Exit status 1 24 error Failed at the express-graphql-typescript-boilerplate@1.0.0-rc.3 db:migrate script 'knex migrate:latest'. 24 error Make sure you have the latest version of node.js and npm installed. 24 error If you do, this is most likely a problem with the express-graphql-typescript-boilerplate package, 24 error not with npm itself. 24 error Tell the author that this fails on your system: 24 error knex migrate:latest 24 error You can get information on how to open an issue for this project with: 24 error npm bugs express-graphql-typescript-boilerplate 24 error Or if that isn't available, you can get their info via: 24 error npm owner ls express-graphql-typescript-boilerplate 24 error There is likely additional logging output above. 25 verbose exit [ 1, true ]I tried running 'knex' but it was not recogized, so I loaded it globally. Re-ran db:migrate script with same results. Tried running 'knex migrate:latest' directly, and got this error ` PS C:\Dev\Play\graphQL\express-graphql-typescript-boilerplate-master> knex migrate:latest Requiring external module ts-node/register
C:\Dev\Play\graphQL\express-graphql-typescript-boilerplate-master\node_modules\ts-node\src\index.ts:316 throw new TSError(formatDiagnostics(diagnosticList, cwd, ts, lineOffset)) ^ TSError: ⨯ Unable to compile TypeScript Cannot find type definition file for 'fs-extra'. (2688) Cannot find type definition file for 'handlebars'. (2688) Cannot find type definition file for 'highlight.js'. (2688) Cannot find type definition file for 'lodash'. (2688) Cannot find type definition file for 'marked'. (2688) Cannot find type definition file for 'minimatch'. (2688) Cannot find type definition file for 'node'. (2688) Cannot find type definition file for 'shelljs'. (2688) knexfile.ts (3,16): Cannot find name 'require'. (2304) knexfile.ts (7,1): Cannot find name 'module'. (2304) at getOutput (C:\Dev\Play\graphQL\express-graphql-typescript-boilerplate-master\node_modules\ts-node\src\index.ts:316:17) at C:\Dev\Play\graphQL\express-graphql-typescript-boilerplate-master\node_modules\ts-node\src\index.ts:347:18 at Object.compile (C:\Dev\Play\graphQL\express-graphql-typescript-boilerplate-master\node_modules\ts-node\src\index.ts:474:19) at Module.m._compile (C:\Dev\Play\graphQL\express-graphql-typescript-boilerplate-master\node_modules\ts-node\src\index.ts:410:44 ) at Module._extensions..js (module.js:580:10) at Object.require.extensions.(anonymous function) [as .ts] (C:\Dev\Play\graphQL\express-graphql-typescript-boilerplate-master\no de_modules\ts-node\src\index.ts:413:12) at Module.load (module.js:488:32) at tryModuleLoad (module.js:447:12) at Function.Module._load (module.js:439:3) at Module.require (module.js:498:17) at require (internal/module.js:20:19) at initKnex (C:\Users\Randy\AppData\Roaming\npm\node_modules\knex\bin\cli.js:50:16) at Command. (C:\Users\Randy\AppData\Roaming\npm\node_modules\knex\bin\cli.js:127:17)
at Command.listener (C:\Users\Randy\AppData\Roaming\npm\node_modules\knex\node_modules\commander\index.js:301:8)
at emitTwo (events.js:106:13)
at Command.emit (events.js:194:7)
`