【问题标题】:node:internal/modules/cjs/loader:936 npx react-native run-android节点:内部/模块/cjs/loader:936 npx react-native run-android
【发布时间】:2021-12-14 20:02:14
【问题描述】:

我正在设置我的环境以在 react-native 中进行编码,并且在我运行时

npx react-native run-android

回复是:

:ReactNative:Unexpected empty result of running '[node, C:\Users\fre_z\OneDrive\�?rea de Trabalho\Prog\OmegaApp\node_modules\@react-native-community\cli\build\bin.js, config]' command.
:ReactNative:Running '[node, C:\Users\fre_z\OneDrive\�?rea de Trabalho\Prog\OmegaApp\node_modules\@react-native-community\cli\build\bin.js, config]' command failed.

FAILURE: Build failed with an exception.

* Where:
Script 'C:\Users\fre_z\OneDrive\�rea de Trabalho\Prog\OmegaApp\node_modules\@react-native-community\cli-platform-android\native_modules.gradle' line: 213

* What went wrong:
A problem occurred evaluating script.
node:internal/modules/cjs/loader:936  throw err;  ^Error: Cannot find module 'C:\Users\fre_z\OneDrive\�rea de Trabalho\Prog\OmegaApp\node_modules\@react-native-community\cli\build\bin.js'    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)    at Function.Module._load (node:internal/modules/cjs/loader:778:27)    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)    at node:internal/main/run_main_module:17:47 {  code: 'MODULE_NOT_FOUND',  
requireStack: []}

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan 
to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 971ms

我知道这可能是我在设置环境时出现的错误。但是,我不知道在哪里,我已经重做了两次。

【问题讨论】:

  • 你已经安装了节点,对吧?
  • 是的,我愿意,最新的 lts 版本。

标签: android node.js reactjs react-native


【解决方案1】:

在您的项目中,尝试删除节点模块并重新安装core-util-is

rm -rf node_modules
npm install -g npm@latest
npm i core-util-is

我也猜你克隆了在其他环境中创建的 RN 项目。因此,如果上述步骤失败,您可以尝试在当前设置上创建新的 RN 项目 - 如果它是“可编译的”,您也应该能够运行克隆的项目。

另一个值得尝试的步骤 - 为您的平台重新安装 Node (https://nodejs.org/en/download/)

【讨论】:

    【解决方案2】:

    我不知道为什么,但是我更改了我克隆项目的文件夹并且它起作用了。我猜这是因为路径中的空格和特殊字符。当我在 C 中克隆它时:它起作用了。

    【讨论】:

    • 这并没有提供问题的答案。要批评或要求作者澄清,请在他们的帖子下方留下评论。 - From Review
    猜你喜欢
    • 2022-06-27
    • 2022-11-30
    • 2022-11-10
    • 2022-08-05
    • 1970-01-01
    • 2023-02-13
    • 1970-01-01
    • 1970-01-01
    • 2022-11-10
    相关资源
    最近更新 更多