【发布时间】:2020-04-25 18:09:29
【问题描述】:
我有这个运行良好的 react-native 应用程序,但突然我收到这个错误:
error: bundling failed: Error: Unable to resolve module `fs` from `node_modules/eslint/lib/cli-engine/cli-engine.js`: fs could not be found within the project.
我第一次得到它时,只是在测试应用程序,做我一整天都在做的事情,没有什么新鲜的,没有什么不寻常的。现在我什至无法在我的设备上启动应用程序。
我用这个脚本启动应用程序:yarn start-fresh from my package.json:
"start-fresh": "cd android/ && ./gradlew clean && cd .. && rm -rf node_modules/ && yarn install && react-native start --reset-cache"
然后在一个新的终端选项卡中,我执行yarn android。它在第二个选项卡中加载一切正常,但是当我返回第一个选项卡(我在其中运行 yarn start-fresh)时,它加载了一些内容,但随后出现错误。我不记得安装任何新软件包或更新软件包或类似的东西......
我尝试在线搜索解决方案,但找不到任何有用的信息。另外,在错误之后我有这个列表:
If you are sure the module exists, try these steps:
1. Clear watchman watches: watchman watch-del-all
2. Delete node_modules: rm -rf node_modules and run yarn install
3. Reset Metro's cache: yarn start --reset-cache
4. Remove the cache: rm -rf /tmp/metro-*
我尝试了那里列出的所有方法,但都没有成功。
谁能帮我让这个应用再次运行?
【问题讨论】:
-
你在代码中使用 react-native-fs 吗?
标签: react-native eslint yarnpkg