在 npm 运行 构建期间找不到名称 'AbortSignal'
Cannot find name 'AbortSignal' during npm run build
node_modules/axios/index.d.ts:93:12 - error TS2304: Cannot find name 'AbortSignal'.
93 signal?: AbortSignal;
~~~~~~~~~~~
Found 1 error.
当为 node typescript 项目尝试 npm run build
命令时,出现上述错误,与 axio 包有关。在使用 axio 之前,npm 运行 build 工作正常。
您需要将 DOM 添加到 tsconfig.json
中的 lib 数组:
"lib": [
"es2018",
"DOM"
],
您还可以将 "skipLibCheck": true,
添加到 compilerOptions
下的 tsconfig.json
。
这将忽略 node_modules
下的库中存在的错误
node_modules/axios/index.d.ts:93:12 - error TS2304: Cannot find name 'AbortSignal'.
93 signal?: AbortSignal;
~~~~~~~~~~~
Found 1 error.
当为 node typescript 项目尝试 npm run build
命令时,出现上述错误,与 axio 包有关。在使用 axio 之前,npm 运行 build 工作正常。
您需要将 DOM 添加到 tsconfig.json
中的 lib 数组:
"lib": [
"es2018",
"DOM"
],
您还可以将 "skipLibCheck": true,
添加到 compilerOptions
下的 tsconfig.json
。
这将忽略 node_modules