node.js - 使用 next.js,为什么我突然开始看到 Module not found: Error: Can't resolve 'fs'?
问题描述
我什么都没改变,但正在使用"next": "9.4.4"
,我看到:
Module not found: Can't resolve 'fs' in 'web/node_modules/graceful-fs'
Could not find files for /app/d/[id] in .next/build-manifest.json
ModuleNotFoundError: Module not found: Error: Can't resolve 'fs' in 'web/node_modules/graceful-fs'
我可能做错了什么?
解决方案
看起来你不在/api
目录中。客户端代码无法导入fs
,只有 API 文件可以
推荐阅读
- oracle - Oracle 中信用卡号的较短哈希值
- javascript - 从一年中的几天开始用 HTML 填充 Bootstrap 表
- python - 将列表命名为另一个列表中的元素
- c# - syncfusion xlsio 将列类型从文本更改为数字
- git - gitignore a given folder in multiple subfolders
- python - 从solve_ivp提取、打印和绘制中间值
- azure - Azure 应用服务运行状况检查警报未触发
- python - 根据特定列上的条件将两个数据帧相乘的有效方法
- flutter - Flutter Dart setState 不起作用:未处理的异常:setState() 在构造函数中调用:...(生命周期状态:已创建,无小部件,未安装)
- javascript - 如何使用索引将对象添加到嵌套数组?