错误的表达式:非弦乐值传递到typescript中的`ts.resolvetypeRecredectextive'
当我尝试运行ts-node-dev./index.ts时,我会遇到以下错误,我更新了typescript和ts-node-dev,ts-node,但是如果我删除具有@Types的依赖关系,则此错误会继续弹出/xxxx(例如:@type/express)它工作正常。
false表达式:非弦乐值传递给ts.ResolvetypeRecredectiveDixed
,可能是通过使用过时的resolvetyperedrectedirectives
签名的包装软件包。这可能不是TS本身的问题。
"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"
},
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"
},
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(15)
升级到
“ TS节点”:“ 10.8.1”
为我解决了问题。Upgrading to
"ts-node": "10.8.1"
solved the issue for me.解决方案
我的问题是由从
4.6
升级到^4.7
引起的,我这样做是为了解决它:我使用
“ ts-node”:“^ 10.7.0“
和“ ts-node-dev”:“^1.1.8”
,在升级两个dev-deps后,解决了问题。为什么
TS 4.7升级“ noreferrer”>解决模式(请参阅最后一行)。鉴于
ts-node
和ts-node-dev
正在内部使用旧的分辨率模式,将其更新为以后的版本@> = 10.8.0 和ts-node-dev@= 2
,解决此问题。升级后仅升级“ ts-node”(来自houssem hichri的答案),因此添加了本章
@khachaturstepanyan tl; Dr
,因为我正在使用
“ ts-node-dev”:“^1.1.8”,因此仍然存在错误。
。Solution
My problem was caused by upgrading typescript from
4.6
to^4.7
, and I did this to fix it:I was using
"ts-node": "^10.7.0"
, and"ts-node-dev": "^1.1.8"
, after upgrading both dev-deps, the issue was solved.Why
TS 4.7 upgrades the resolution mode (see the last line). Given that the
ts-node
andts-node-dev
are using the old resolution mode internally, updating them to the later version, to be exactts-node@>=10.8.0
andts-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"
.我将TypeScript升级到
4.7.4
,然后通过将ts-loader
升级到9.3.1
来修复。I was upgrading typescript to
4.7.4
and I fixed this by upgradingts-loader
to9.3.1
.尝试将降级降级到如果没有安装
ts-node
,则可能需要此问题。Try downgrading to [email protected]. This may be needed if this issue occurs without
ts-node
installed.如果以上问题对您不起作用。...
尝试更新TS-loader ....
命令是:
npm install ts-loader@最新
If none of the above issues works for you....
Do try updating ts-loader also....
The command is:
npm install ts-loader@latest
纱线添加-d ts节点
或npm install -save-dev ts-node
解决问题yarn add -D ts-node
ornpm install --save-dev ts-node
solves the problem我也有同样的问题。我在 webpack configs 之前用babel-loader替换了ts-loader
:
之后:
I had the same issue. I replaced ts-loader with babel-loader in webpack configs
before:
after:
使用typeorm 0.2.43& Typescript 4.9.5
在我的代码上解决的问题,将TS节点升级到10.9.1(现在是最后版本)
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)
使用以下版本对我有用。
TS节点10.8.1
&节点14.17.3
Using the following versions worked for me.
ts-node 10.8.1
&node 14.17.3
我的问题是,即使本地项目中的一个已经很好,我有一个过时的全球版本的TS节点,这引起了问题。我通过卸载全局版本和使用NPX版本来解决它。
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.
由于没有人提到它,所以我正在升级包装的版本,而在升级和构建此错误之间弹出的某个地方。我无法弄清楚先前的答案是否有用,所以我只是在验证我的
package.json.json
具有我想要的依赖项后,我只是nukedrm package-lock.json
。再次使用新的软件包 - 洛克.json
构建后,我的项目成功了。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 mypackage.json
has the dependencies I want. After building again with a newpackage-lock.json
, my project succeeded.可能是一个节点版本错误,因此请尝试更新您的节点版本,然后检查package.json文件
probably it's a node versioning error, so try to update your node version and check package.json file
将TS-Loader和TS节点更新为最新,在我的情况下已解决
updating ts-loader and ts-node to latest , resolved in my case
这不是TS错误。升级到最新版本是推荐的路径。
但是,在我的应用程序转移到最新版本的TS中,没有提供显着优势,因此,我将TS降级到V4.2.4版本从v4.9.5降低,以暂时解决该问题。
如果您的情况与我的情况相似(其他高度优先级),请延迟TS升级策略,以便如果不提出质量问题。
It is not a TS error. Upgrading to the latest version is the recommended path.
However, in my app moving to the latest version of TS did not provide significant advantages hence, I downgraded the TS to the version v4.2.4 from v4.9.5 to resolve the issue temporarily.
In case your situation is similar to mine (other high priorities) then delay TS upgrade strategy for time being if it is not posing quality issues.
以下工作
Following worked >>