knex 0.16 doesn't support knexfiles written in TypeScript
See original GitHub issueEnvironment
Knex version: 0.16.3
Database + version: docker postgres:10.4
OS: Windows 10 Pro & Docker node:8.14.0
Bug
knex migrate:make --knexfile knexfile.ts
- Error message:
Unexpected token import
Works normally on 0.15.x
Issue Analytics
- State:
- Created 5 years ago
- Reactions:7
- Comments:86 (16 by maintainers)
Top Results From Across the Web
knex 0.16 doesn't support knexfiles written in TypeScript -
Environment. Knex version: 0.16.3. Database + version: docker postgres:10.4. OS: Windows 10 Pro & Docker node:8.14.0 ...
Read more >Changelog - Knex.js
Fix error message for missing migration files #4937; Move deferrable to after on ... Add TypeScript support for deferrable, new Primary/Unique syntax #4589 ......
Read more >0.16.3 - knex - npm
A SQL query builder that is flexible, portable, and fun to use! A batteries-included, multi-dialect (MSSQL, MySQL, PostgreSQL, SQLite3, Oracle ( ...
Read more >Bookshelf.js | Home
js, built on the Knex SQL query builder. It features both Promise-based and traditional callback interfaces, transaction support, eager/nested-eager relation ...
Read more >Knexfile Not Using TS Paths - node.js - Stack Overflow
My Knexfile is written in Typescript with some path aliases coming from tsonfig.json, but Knex fails with Cannot find module ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@brunolm why are you so ignorant?
I was facing the same issue with Knex version
0.16.3
.This solution is not encouraged but I simply fixed it by simply adding
ts-node/register
at the beginning ofknexfile.ts
file.