Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
Ask Question
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: Non-string value passed to
ts.resolveTypeReferenceDirective
, likely by a wrapping package working with an outdated
resolveTypeReferenceDirectives
signature. This is probably not a problem in TS itself.
"dependencies": {
"ajv": "^8.9.0",
"axios": "^0.27.1",
"exceljs": "^4.3.0",
"express": "^4.17.1",
"json2csv": "^5.0.7",
"moment-timezone": "^0.5.33",
"mysql": "^2.18.1",
"mysql-utilities": "^1.1.3",
"q": "^1.5.1",
"ts-node": "^10.8.0",
"ts-node-dev": "^2.0.0",
"typescript": "^4.7.2",
"winston": "^3.3.3",
"winston-daily-rotate-file": "^4.5.5"
"devDependencies": {
"@types/chai": "^4.2.22",
"@types/express": "^4.17.11",
"@types/jest": "^27.4.0",
"@types/mocha": "^9.0.0",
"@types/mysql": "^2.15.20",
"@types/node": "^15.6.1",
"chai": "^4.3.4",
"jest": "^27.4.7",
"mocha": "^9.1.2",
"ts-jest": "^27.1.3"
–
–
–
–
–
–
Solution
My problem was caused by upgrading typescript from 4.6
to ^4.7
, and I did this to fix it:
# With NPM
npm install ts-node-dev@latest ts-node@latest
# With yarn
yarn upgrade ts-node-dev@latest ts-node@latest
# With pnpm
pnpm up ts-node-dev@latest ts-node@latest
I was using "ts-node": "^10.7.0"
, and "ts-node-dev": "^1.1.8"
, after upgrading both dev-deps, the issue was solved.
TS 4.7 upgrades the resolution mode (see the last line). Given that the ts-node
and ts-node-dev
are using the old resolution mode internally, updating them to the later version, to be exact ts-node@>=10.8.0
and ts-node-dev@>=2
, fixes this problem.
This chapter is added for @KhachaturStepanyan
TL;DR
After upgrading only "ts-node"(from Houssem Hichri's answer), the error remained, because I was using "ts-node-dev": "^1.1.8"
.
–
–
My issue was that I had an out of date global version of ts-node that was causing issues, even though the one in the local project was fine. I resolved it by uninstalling the global version and using the npx version.
npm uninstall -g ts-node
npx ts-node app.ts
Since no one mentioned it, I was upgrading versions of a package, and somewhere between upgrading and building this error popped up. I couldn't figure out if the previous answers were useful, so I just nuked rm package-lock.json
after verifying that my package.json
has the dependencies I want. After building again with a new package-lock.json
, my project succeeded.
Using typeorm 0.2.43 & typescript 4.9.5
Problem fixed on my code upgrading ts-node to 10.9.1 (lastest version by now)
npm install ts-node@latest -D
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.