ts-node-dev: Code broken after update from "1.0.0-pre.44" to "1.0.0-pre.49"

Error after update from “1.0.0-pre.44” to “1.0.0-pre.49”.

// package.json
  "devDependencies": {
    "@types/express": "^4.17.6",
    "@types/jest": "^26.0.0",
    "@types/node": "^12.12.47",
    "apollo-boost": "^0.4.9",
    "axios": "^0.19.2",
    "env-cmd": "^10.1.0",
    "graphql-request": "^2.0.0",
    "jest": "^26.0.1",
    "ts-jest": "^26.1.1",
    "ts-node-dev": "^1.0.0-pre.49",
    "typescript": "^3.9.5"
  },
  "dependencies": {
    "apollo-server": "^2.15.0",
    "graphql": "^14.5.8",
    "mssql": "^6.2.0",
    "reflect-metadata": "^0.1.10",
    "ts-node": "^8.10.2",
    "tsconfig-paths": "^3.9.0",
    "type-graphql": "^0.17.5",
    "typeorm": "^0.2.25"
  },
"scripts": {
    "dev": "env-cmd -e dev ts-node-dev --type-check --respawn src/index.ts",
// index.ts
import 'reflect-metadata'
import 'tsconfig-paths/register'
i
import { createConnections } from 'typeorm'

import { AccountResolver } from './resolvers/AccountResolver'
;(async () => {
  try {
    await createConnections()
  } catch (error) {
    console.log('Failed creating database connections: ', error)
  }
}

Thrown error:

env-cmd -e dev ts-node-dev --type-check --respawn src/index.ts

Using ts-node version 8.10.2, typescript version 3.9.5 Failed creating database connections: MissingDriverError: Wrong driver: “undefined” given. Supported drivers are: “cordova”, “expo”, “mariadb”, “mongodb”, “mssql”, “mysql”, “oracle”, “postgres”, “sqlite”, “sqljs”, “react-native”, “aurora-data-api”, “aurora-data-api-pg”.

I tried to delete the folder node_modules and have it reinstalled but I always end up with the same error. I am certain that the database driver with typeorm is correctly defined. The only thing I did was upgrading the package ts-node-dev.

Did something change? I tried looking for a change log for the upgrade but couldn’t find it.

Downgrading fixed the issue again:

npm install -D ts-node-dev@1.0.0-pre.44

On a side note there’s a small typo in the README: image

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 36 (12 by maintainers)

Most upvoted comments

@DarkLite1 Ok will check.

@pruhstal I was fixing this issue before but it seems that wasn’t enough. Will fix this.

@DarkLite1 I just wanted to understand if timeout works in your case. I will look into it.

@pruhstal thanks for testing. It happens only on my production server Windows Server 2016 with node v12.18.1.

I can not imagine what changes could lead to such unrelated to ts-node-dev error. You probably have to debug the source for this error in your app.

--type-check is enabled by default now.