rn-trackshare 无法编译

来源:15-11 RN App社会化分享、第三方登录开发精讲-2【必备加分技能】

慕移动3503427

2022-11-16

老师,无法编译? 求查看,谢谢。

F:\rn\rn-trackshare (master) (github_rn@0.0.1)
λ yarn android
yarn run v1.22.19
$ react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using “–no-jetifier” flag.
Jetifier found 1129 file(s) to forward-jetify. Using 6 workers…
info Starting JS server…
info Installing the app…

Task :app:installDebug
Installing APK ‘app-debug.apk’ on ‘api30(AVD) - 11’ for app:debug
Installed on 1 device.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use ‘–warning-mode all’ to show the individual deprecation warnings.
See https://docs.gradle.org/6.9/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 11s
242 actionable tasks: 2 executed, 240 up-to-date
info Connecting to the development server…
info Starting the app on “emulator-5554”…
Starting: Intent { cmp=com.github_rn/.MainActivity }

:error: Error: While trying to resolve module @react-native/normalize-color from file F:\rn\rn-trackshare\node_modules\deprecated-react-native-prop-types\DeprecatedColorPropType.js, the package F:\rn\rn-trackshare\node_modules\@react-native\normalize-color\package.json was successfully found. However, this package itself specifies a main module field that could not be resolved (F:\rn\rn-trackshare\node_modules\@react-native\normalize-color\index. Indeed, none of these files exist:

  • F:\rn\rn-trackshare\node_modules@react-native\normalize-color\index(.native|.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)
  • F:\rn\rn-trackshare\node_modules@react-native\normalize-color\index\index(.native|.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)
    at DependencyGraph.resolveDependency (F:\rn\rn-trackshare\node_modules\metro\src\node-haste\DependencyGraph.js:311:17)
    at Object.resolve (F:\rn\rn-trackshare\node_modules\metro\src\lib\transformHelpers.js:129:24)
    at resolve (F:\rn\rn-trackshare\node_modules\metro\src\DeltaBundler\traverseDependencies.js:396:33)
    at F:\rn\rn-trackshare\node_modules\metro\src\DeltaBundler\traverseDependencies.js:412:26
    at Array.reduce ()
    at resolveDependencies (F:\rn\rn-trackshare\node_modules\metro\src\DeltaBundler\traverseDependencies.js:411:33)
    at processModule (F:\rn\rn-trackshare\node_modules\metro\src\DeltaBundler\traverseDependencies.js:140:31)
    at async addDependency (F:\rn\rn-trackshare\node_modules\metro\src\DeltaBundler\traverseDependencies.js:230:18)
    at async Promise.all (index 0)
    at async processModule (F:\rn\rn-trackshare\node_modules\metro\src\DeltaBundler\traverseDependencies.js:198:5)
    BUNDLE ./index.js

error: Error: While trying to resolve module @react-native/normalize-color from file F:\rn\rn-trackshare\node_modules\deprecated-react-native-prop-types\DeprecatedColorPropType.js, the package F:\rn\rn-trackshare\node_modules\@react-native\normalize-color\package.json was successfully found. However, this package itself specifies a main module field that could not be resolved (F:\rn\rn-trackshare\node_modules\@react-native\normalize-color\index. Indeed, none of these files exist:

  • F:\rn\rn-trackshare\node_modules@react-native\normalize-color\index(.native|.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)
  • F:\rn\rn-trackshare\node_modules@react-native\normalize-color\index\index(.native|.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)
    at DependencyGraph.resolveDependency (F:\rn\rn-trackshare\node_modules\metro\src\node-haste\DependencyGraph.js:311:17)
    at Object.resolve (F:\rn\rn-trackshare\node_modules\metro\src\lib\transformHelpers.js:129:24)
    at resolve (F:\rn\rn-trackshare\node_modules\metro\src\DeltaBundler\traverseDependencies.js:396:33)
    at F:\rn\rn-trackshare\node_modules\metro\src\DeltaBundler\traverseDependencies.js:412:26
    at Array.reduce ()
    at resolveDependencies (F:\rn\rn-trackshare\node_modules\metro\src\DeltaBundler\traverseDependencies.js:411:33)
    at processModule (F:\rn\rn-trackshare\node_modules\metro\src\DeltaBundler\traverseDependencies.js:140:31)
    at async addDependency (F:\rn\rn-trackshare\node_modules\metro\src\DeltaBundler\traverseDependencies.js:230:18)
    at async Promise.all (index 0)
    at async processModule (F:\rn\rn-trackshare\node_modules\metro\src\DeltaBundler\traverseDependencies.js:198:5)
写回答

1回答

CrazyCodeBoy

2022-11-18

你在项目跟目录下运行下npm install将依赖安装完成之后在试下看看
0
1
慕移动3503427
谢谢, 已经解决, yarn 安装即可。 npm 安装normalize-color 东西不全,另外安装之后,需要替换 com.facebook.react:react-native:+ 为 com.facebook.react:react-native:0.66.0 ,否则会用最新的0.70 包。
2022-12-02
共1条回复

RN入门到进阶,打造高质量上线App

解锁React Native开发应用新姿势,React Native新版本热门技术

3144 学习 · 3241 问题

查看课程