Waseem Khan
Waseem Khan

Reputation: 65

Build Failed in Visual Studio React Native App

I'm getting the following error in VS, can anyone please provide a fix for it, what I'm doing wrong? Is there something missing?

C:\Users\Glock\Desktop\Project\Instagram-clone-master\android>gradlew assembleRelease
:ReactNative:Unexpected empty result of running '[node, undefined, config]' command.
:ReactNative:Running '[node, undefined, config]' command failed.

FAILURE: Build failed with an exception.

* Where:
Script 'C:\Users\Glock\Desktop\Project\Instagram-clone-master\node_modules\@react-native-community\cli-platform-android\native_modules.gradle' line: 170

* What went wrong:
A problem occurred evaluating script.
> internal/modules/cjs/loader.js:985  throw err;  ^Error: Cannot find module 'C:\Users\Glock\Desktop\Project\Instagram-clone-master\android\undefined'    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:982:15)    at Function.Module._load (internal/modules/cjs/loader.js:864:27)    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)    at internal/main/run_main_module.js:18: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 3s

I created a new project, and it works fine with BUILD SUCCESSFUL. But for my existing project, now I have this error:

* What went wrong:
A problem occurred evaluating script.
> internal/modules/cjs/loader.js:985  throw err;  ^Error: Cannot find module 'C:\Users\Glock\Desktop\Project\Instagram-clone-master\android\undefined'    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:982:15)    at Function.Module._load (internal/modules/cjs/loader.js:864:27)    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)    at internal/main/run_main_module.js:18:47 {  code: 'MODULE_NOT_FOUND',  requireStack: []}

Upvotes: 0

Views: 2150

Answers (1)

Hend El-Sahli
Hend El-Sahli

Reputation: 6752

Try to run this command in the root folder of your project

npm install --save-dev @react-native-community/cli

Then run your project through this command

yarn|npm react-native run-ios

  • Remove any global installation of react-native

Upvotes: 4

Related Questions