1

安装 node-config 和 @types/config 后:

npm install config
npm install @types/config

当我尝试在我的应用程序中使用时:

import config from 'config';

我收到错误消息:

Module not found: Error: Can't resolve 'fs'

我安装了'fs'模块,但仍然出现此错误。

Module not found: Error: Can't resolve 'fs'
4

1 回答 1

0

听起来您正在尝试在模块不可用node-config的前端代码或 React Native 中使用。fs这是[不支持])https://github.com/lorenwest/node-config/issues/367)。

与 Node.js 一起使用时应该不需要安装fs模块node-config——该fs模块是内置在 Node.js 中的。

于 2018-08-17T13:10:21.453 回答