【发布时间】:2020-05-13 07:18:58
【问题描述】:
我有一个名为config.ts 的文件,其中包含以下代码:
let config = {
foo: {
bar: [{env: "test"}...],
...
...
}
};
module.exports = config;
我想在应用程序范围内使用此文件。
但是,此代码会导致以下错误:
ERROR in src/app/configs/config.ts:357:1 - error TS2591: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i @types/node` and then add `node` to the types field in your tsconfig.
357 module.exports = config;
我检查了我是否安装了@types/node,并且tsconfig.json 文件在compilerOptions 下包含"types": ["node"]。
如何解决这个问题?
【问题讨论】:
标签: node.js typescript