qinglong icon indicating copy to clipboard operation
qinglong copied to clipboard

2.17.8和2.17.9中ts脚本中引入自定义模块报错

Open Firfr opened this issue 1 year ago • 3 comments

Qinglong version

2.17.8,2.17.9

Steps to reproduce

下面语句报错 import { fnGet请求, fnGet请求_代理, fnGotify请求 } from './工具/请求.ts'; 是在docker镜像从2.17.7升级到2.17.8和2.17.9这两个版本后发生的错误,在2.17.7和之前版本能正常运行,镜像版本退回到2.17.7之后,报错消失

What is expected?

如何解决

What is actually happening?

具体报错如下

开始执行... 2024-08-03 21:20:03

Error: Cannot find module 'tslib' Require stack:

  • /ql/data/scripts/0-我的任务/docker.ts at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1145:15) at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue [as _resolveFilename] (/usr/local/lib/node_modules/ts-node/node_modules/@cspotcode/source-map-support/source-map-support.js:811:30) at Function.Module._load (node:internal/modules/cjs/loader:986:27) at Module.require (node:internal/modules/cjs/loader:1233:19) at require (node:internal/modules/helpers:179:18) at Object. (/ql/data/scripts/0-我的任务/docker.ts:3:17) at Module._compile (node:internal/modules/cjs/loader:1358:14) at Module.m._compile (/usr/local/lib/node_modules/ts-node/src/index.ts:1618:23) at Module._extensions..js (node:internal/modules/cjs/loader:1416:10) at Object.require.extensions. [as .ts] (/usr/local/lib/node_modules/ts-node/src/index.ts:1621:12) { code: 'MODULE_NOT_FOUND', requireStack: [ '/ql/data/scripts/0-我的任务/docker.ts' ] }

执行结束... 2024-08-03 21:20:04 耗时 1 秒   

System Info

No response

Any additional comments?

No response

Firfr avatar Aug 04 '24 08:08 Firfr

你的目录是有 tsconfig.json 文件?还是引用了什么 importHelp ?

whyour avatar Aug 04 '24 13:08 whyour

image 佬 为啥要改这块呀 改了项目 package.json 配置 "type": "module", 后 就不识别.ts文件了

ydz777 avatar Aug 05 '24 08:08 ydz777

image 佬 为啥要改这块呀 改了项目 package.json 配置 "type": "module", 后 就不识别.ts文件了

tsx 执行有大环境变量的文件会报错,ts 文件为什么要加 type: module ?

whyour avatar Aug 05 '24 09:08 whyour