Questions tagged [ts-node-dev]
29 questions
111
votes
14 answers
False expression: Non-string value passed to `ts.resolveTypeReferenceDirective` in typescript
When I try to run ts-node-dev./index.ts, I get the below error, I updated my typescript and ts-node-dev, ts-node but this error keeps on popping if I remove dependencies that have @types/XXXX(eg:@types/express) it is working fine.
False expression:…

Mohamed Anser Ali
- 1,269
- 2
- 8
- 13
8
votes
1 answer
ts-node-dev runs into an error: "Cannot find module 'typescript'"
I am trying to set up a basic nest.js app.
main.js is in the src folder. I run this command:
npx ts-node-dev src/main.ts
I get this error:
Cannot find module 'typescript'
Require stack:
-…

Yilmaz
- 35,338
- 10
- 157
- 202
7
votes
3 answers
Error importing PrismaClient in code compiled from typescript [SyntaxError: Named export 'PrismaClient' not found]
In server.ts, importing PrismaClient like this:
import { PrismaClient } from '@prisma/client';
export const prisma = new PrismaClient();
throws an Error when building with tsc and running the compiled code:
yarn run build && yarn run start
import…

G. ShadowBroker
- 115
- 1
- 3
- 7
7
votes
2 answers
Command not found: ts-node-dev
I am moving from nodemon to ts-node-dev but I am not able to run my index.ts file using ts-node-dev.
I did the following:
yarn add ts-node-dev --dev
In my package.json I have:
"devDependencies": {
...
"nodemon": "^1.19.2",
"ts-node":…

Magofoco
- 5,098
- 6
- 35
- 77
6
votes
1 answer
Specify alternate tsconfig.json for VS Code / ts-node / ts-node-dev
I'm migrating my project from JavaScript to Typescript.
I want to have the default tsconfig.json to show stricter warnings in VS Code, but have an alternate tsconfig.json with more lenient tsc compiler options to allow a successful build.
The…

Tom Hale
- 40,825
- 36
- 187
- 242
5
votes
0 answers
How to use normal imports and top-level await at the same time?
I want to use imports (import x from y) and top-level awaits at the same time with ts-node. However if I change my tsconfig.compilerOptions.module to es2017 or higher as required by top-level awaits I get:
SyntaxError: Cannot use import statement…

leonheess
- 16,068
- 14
- 77
- 112
3
votes
1 answer
Apollo Sandbox says turn on introspection but introspection is already turned on | Apollo server + TypeScript
I have been using Apollo server for quite sometime now, and I have built a number of projects with it, but, recently I wanted to use it in conjunction with TypeScript, I finally got it to work after many trials, but I got stuck with Apollo Sandbox,…

Abdurahman Shiine
- 33
- 4
3
votes
0 answers
ts-node-dev not reloading certain files
I tried using both nodemon + ts-node as well as ts-node-dev to have auto-reload while developing.
However, both run into the same issue that certain files are not being watched properly and do not use saved changes unless I manually run npm run…

hopelessmuffins
- 315
- 1
- 11
2
votes
1 answer
ts-node-dev: no script to run provided when using dotenv
I have a script in package.json that runs as expected when using the standard .env file.
"scripts": {
"commands": "ts-node-dev --files deploy-commands.ts",
},
but when I try specify a different .env file (.env.prod)
"scripts": {
"commands":…

grabury
- 4,797
- 14
- 67
- 125
2
votes
2 answers
getting an error "SyntaxError: Unexpected string" near the import statement working with ts-node-dev
i have trying to use typescript libraries with node but I keep getting these SyntaxErrors. i am running the dev script form the package.json using the ts-node-dev.
the error show near the import statements and i am not sure if its a problem with my…

Emmanuel Thomas
- 159
- 1
- 12
1
vote
1 answer
Quotations being added to combined npm script
I'm attempting to combine 2 npm scripts in one, but when I do the output is incorrect and causes flags to not be passed. Using the dotenv package is not an option and using ampersands is not helping.
So in package.json I have this -
"define:local":…

ssdev
- 99
- 6
1
vote
0 answers
Typescript compiled JS works but ts-node-dev throws compilation errors
I am trying to use the npm package fs-xattr in a Typescript project but I cannot seem to get things working between both tsc and ts-node-dev.
When I run npm run build && node index.js it works fine. When I run npm run dev then it crashes with the…

shiznatix
- 11
- 4
1
vote
2 answers
i cannot use ts-node-dev to start ts+express+node project
when I run npm run dev, I cannot open "http://localhost:3000" in chrome.
Executing task:
> npm run dev
node-framework-kit@1.0.0 dev /Users/xiaoqi/node-workplace/node-framework-kit
ts-node-dev --respawn --transpile-only ./src/app.ts
[INFO]…

taoxiaoqi
- 19
- 1
- 4
1
vote
0 answers
Typescript Error: TS2451 Cannot redeclare block-scoped variable in NodeJS
I'm building a NodeJS API using Typescript but ran into the error shown below.
Been on it for hours and all the solutions I've tried didn't work.
[ERROR] 22:49:39 ⨯ Unable to compile TypeScript:
src/services/orgService.ts:8:7 - error TS2451: Cannot…

Phemi
- 33
- 1
- 1
- 9
1
vote
0 answers
How to import ts file into a js file of an existing nodejs project
I have a regular nodejs backend with some js files. I also have a ts module that is still in development. I put ts files into the backend. And each time I update the ts module, I am running tsc; nodemon src/index.js. But compiling ts codes each…

Muhammed Aydogan
- 570
- 1
- 4
- 22