Getting an error in Android Studio "Caused by: java.lang.Exception: internal/modules/cjs/loader.js:983 throw err; ^Error: Cannot find module 'react-native/cli'" #1121
Jamessmith878889 opened this issue · 0 comments
I am getting below error in android studio for "Sync Project with Gradle file". I have downloaded News app from Shoutem and opened its android folder in Android Studio and getting below error.I have used npm for installation.
Locations are as follows:
nodejs: C:\Program Files\nodejs\node_modules\npm A). C:\Program Files\nodejs\node_modules\npm\node_modules@react-native-community\cli-platform-android B). C:\Program Files\nodejs\node_modules\npm\node_modules@react-native-community\cli-tools
2.Android Studio: C:\Program Files\Android\Android Studio\
3.Android Studio Project: C:\Users\James\AndroidStudioProjects\Test-app\
4.Location for folders ".android",".AndroidStudio3.6" ,".gradle" ,"AndroidStudioProjects": C:\Users\James\
5.C:\Users\James\AppData\Roaming\npm\node_modules\
6.C:\Users\James\AndroidStudioProjects\Test-app\node_modules@react-native-community\cli-platform-android
7.C:\Users\James\AndroidStudioProjects\Test-app\node_modules@react-native-community\cli-tools
Versions:
System: Windows 10
npm -v : 6.14.4
node -v :v12.16.2
"version": "3.1.4" for C:\Users\James\AndroidStudioProjects\Test-app\node_modules@react-native-community\cli-platform-android\package.json (Tried package.json with version 2.1 also but did't work.)
Error:
Caused by: java.lang.Exception: internal/modules/cjs/loader.js:983 throw err; ^Error: Cannot find module 'react-native/cli'Require stack:- C:\Users\James\Test-app\android[eval] at Function.Module._resolveFilename (internal/modules/cjs/loader.js:980:15) at Function.Module._load (internal/modules/cjs/loader.js:862:27) at Module.require (internal/modules/cjs/loader.js:1042:19) at require (internal/modules/cjs/helpers.js:77:18) at [eval]:1:13 at Script.runInThisContext (vm.js:120:20) at Object.runInThisContext (vm.js:311:38) at Object. ([eval]-wrapper:10:26) at Module._compile (internal/modules/cjs/loader.js:1156:30) at evalScript (internal/process/execution.js:94:25) { code: 'MODULE_NOT_FOUND', requireStack: [ 'C:\Users\James\Test-app\android[eval]' ]}