I'm trying to run the following code with ts-node.
我正在尝试使用ts-node运行以下代码。
import { writeFileSync, readFileSync } from 'fs';
However I get:
但是我得到:
src/main/ts/create.ts (1,45): Cannot find module 'fs'. (2307)
What do I need to do in to allow typescript to import the fs module?
我需要做什么来允许typescript导入fs模块?
1 个解决方案
#1
10
You need to run:
你需要运行:
$ npm install @types/node --save-dev
If you need additional information you can refer to the NodeJS QuickStart in the TypeScript Deep Dive by Basarat.
如果您需要其他信息,可以参考Basarat的TypeScript Deep Dive中的NodeJS QuickStart。
#1
10
You need to run:
你需要运行:
$ npm install @types/node --save-dev
If you need additional information you can refer to the NodeJS QuickStart in the TypeScript Deep Dive by Basarat.
如果您需要其他信息,可以参考Basarat的TypeScript Deep Dive中的NodeJS QuickStart。