得到错误“原因:java.lang.Exception:internal / modules / cjs / loader.js:983 throw err; ^ Error:找不到模块'react-native / cli'”#1121

时间:2020-04-19 11:44:17

标签: node.js react-native android-studio gradle react-native-android

我在android studio中遇到以下错误:“使用Gradle文件同步项目”

位置如下:

  1. nodejs:C:\ Program Files \ nodejs \ node_modules \ npm 一种)。 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项目:C:\ Users \ James \ AndroidStudioProjects \ Test-app \

4。文件夹“ .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

版本:

  1. 系统:Windows 10
  2. npm -v:6.14.4
  3. 节点-v:v12.16.2
  4. “版本”:C:\ Users \ James \ AndroidStudioProjects \ Test-app \ node_modules @ react-native-community \ cli-platform-android \ package.json的“ 3.1.4” (还尝试了2.1版的package.json,但没有用。)

错误:

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]' ]}

0 个答案:

没有答案