我正在使用Angular 7。
我尝试在TypeScript中使用fs模块来打开一个目录。 我一直遇到这个错误:“模块未找到:错误:无法解析fs” 已安装types@node和file-system。
我的代码:
import {Component, OnInit} from '@angular/core';
import * as fs from 'file-system';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent implements OnInit {
title = 'my-app';
constructor() {
}
ngOnInit() {
console.log(fs);
}
}
你能帮助我吗?
Node:v10.14.0 Npm:v6.4.1 Angular CLI:v7.1.1