[英]Emit skipped when parsing config typescript files
I have a problem with the node-config library while using typescript.我在使用 typescript 时遇到了 node-config 库的问题。
My config folder is as follows:我的配置文件夹如下:
However after I run tsc and try to start my app from it's entry point (app.js) I get the following error:但是,在我运行 tsc 并尝试从它的入口点(app.js)启动我的应用程序后,我收到以下错误:
Error: Cannot parse config file: '..../config/development.ts': TypeError: config/development.ts: Emit skipped
When deleting the typescript files from that folder and keeping only the.js files it works.从该文件夹中删除 typescript 文件并仅保留 .js 文件时,它可以工作。 Anybody has an idea how I can solve this?
有人知道我该如何解决这个问题吗?
This is how my tsconfig looks:这就是我的 tsconfig 的外观:
"target": "es6"
"module": "commonjs"
"strict": true
"esModuleInterop": true
Any help would be appreciated, thanks!任何帮助将不胜感激,谢谢!
TypeScript files outside of the project folder will produce an Emit skipped error.项目文件夹外的 TypeScript 文件将产生 Emit skipped 错误。 I can't tell if this is your issue because '..../config/' could be inside or outside the project.
我不知道这是否是您的问题,因为“..../config/”可能在项目内部或外部。 In my case, moving my configuration folder into my project worked around the bug.
就我而言,将我的配置文件夹移动到我的项目中可以解决该错误。 Blechy.
布莱希。
https://github.com/TypeStrong/ts-node/issues/693 https://github.com/TypeStrong/ts-node/issues/693
"allowJS": true
works for me. "allowJS": true
适合我。
The forcing to chage the settings is not good, but this error has been admitted as bug.强制更改设置不好,但此错误已被承认为错误。 https://github.com/TypeStrong/ts-node/issues/693
https://github.com/TypeStrong/ts-node/issues/693
I got this error for having an index.js
file next to an index.ts
file.我在
index.ts
文件旁边有一个index.js
文件时出现此错误。 I somehow rendered my TS to my rootDir source folder.我以某种方式将我的 TS 渲染到我的 rootDir 源文件夹。
Terminal grab of error and fix:终端抓取错误并修复:
> node --loader ts-node/esm src/index.ts
/sandbox/node_modules/ts-node/src/index.ts:944
throw new TypeError(`${relative(cwd, fileName)}: Emit skipped`);
^
TypeError: src/services/index.js: Emit skipped
at getOutput (/sandbox/node_modules/ts-node/src/index.ts:944:17)
at Object.compile (/sandbox/node_modules/ts-node/src/index.ts:1243:30)
at /sandbox/node_modules/ts-node/src/esm.ts:282:37
at Generator.next (<anonymous>)
at /sandbox/node_modules/ts-node/dist/esm.js:8:71
at new Promise (<anonymous>)
at __awaiter (/sandbox/node_modules/ts-node/dist/esm.js:4:12)
at transformSource (/sandbox/node_modules/ts-node/dist/esm.js:127:16)
at /sandbox/node_modules/ts-node/src/esm.ts:197:51
at Generator.next (<anonymous>)
sandbox@sse-sandbox-4stfq:/sandbox$ ls src/services/
index.js index.ts user
sandbox@sse-sandbox-4stfq:/sandbox$ rm src/services/index.js
If nothing worked for you try updating ts-node
to 10.7
.如果没有任何效果,请尝试将
ts-node
更新为10.7
。 It worked for me.它对我有用。
"ts-node": "^10.7.0",
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.