node.js - 应用程序构建失败并在本机反应中出现异常,评估脚本时出现问题
问题描述
我是本机反应的新手。当我运行我的应用程序时,命令行中出现以下错误。请用适当的解决方案指导我......谢谢。
FAILURE:构建失败并出现异常。
其中:脚本 'E:\My Final Year Project\Home_Page\node_modules@react-native-community\cli-platform-android\native_modules.gradle' 行:170
出了什么问题:评估脚本时出现问题。
内部/模块/cjs/loader.js:797 抛出错误;^错误:找不到模块'@react-native-community/cli'需要堆栈:- E:\My Final Year Project\Home_Page\android[eval] at Function.Module._resolveFilename (internal/modules/cjs/loader.js :794:15) 在 Function.Module._load (internal/modules/cjs/loader.js:687:27) 在 Module.require (internal/modules/cjs/loader.js:849:19) 在 require (internal/ modules/cjs/helpers.js:74:18) 在 [eval]:1:13 在 Script.runInThisContext (vm.js:116:20) 在 Object.runInThisContext (vm.js:306:38) 在 Object. ([eval]-wrapper:9:26) 在 Module._compile (internal/modules/cjs/loader.js:956:30) at evalScript (internal/process/execution.js:80:25) { code: 'MODULE_NOT_FOUND ', requireStack: ['E:\My Final Year Project\Home_Page\android\[eval]' ]}
尝试:使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。运行 --scan 以获得完整的见解。
在https://help.gradle.org获得更多帮助
36 秒内构建失败
错误 无法安装应用程序。确保您已设置 Android 开发环境:https ://facebook.github.io/react-native/docs/getting-started.html#android-development-environment 。使用 --verbose 标志运行 CLI 以获取更多详细信息。错误:命令失败:gradlew.bat app:installDebug -PreactNativeDevServerPort=8081 :ReactNative:Unexpected empty result of running 'node -e console.log(require('@react-native-community/cli').bin);' 命令。:ReactNative:Running 'node -e console.log(require('@react-native-community/cli').bin);' 命令失败。
解决方案
再次阅读 react-native 入门文档。好像你错过了一步。错误是说您缺少@react-native-community/cli
应该在初始 react-native 环境设置期间添加的模块。
推荐阅读
- javascript - 如何在工具提示中添加新值?
- javascript - 如何为每个具有类的 div 赋予函数
- python - Seaborn facetgrid 为 y 轴标签添加逗号
- python - 使用输入来放置功能和多项选择
- ios - NSOperationQueue setSuspended Crash iOS
- android - 在不使用 postValue() 的情况下调用 MutableLiveData Observer
- perl - 如何在 Perl 中使用正则表达式替换 2 个不同文件中的行?
- javascript - 如何在与“setInterval”不同的 if 语句中使用“clearInterval”
- c++ - 为什么 lambda 中的变量无法调用该函数
- json - 无法从 Qt 中的文件中读取 json