-->
当前位置:首页 > articles > 正文内容

Luz3个月前 (10-27)articles357

I can't create resources for android with react-native bundle, I get Unable to resolve module error

  • Jon 问题:
    • Install JDK11 (previously installed).Clone the React Native project from repository.Run command
    npm install
    .Update Gradle to version 7.3.3 (I have done this by opening the Android project with Android Studio).
  • At this point I can run the app with the
    react-native run-android
    command, but no image loads. Of course, as I have cloned the project from scratch, I have to create the resources. For that I execute this command, which I have used many times in the past:
  • react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/ app/src/main/res
  • warn Package react-native-vector-icons contains invalid configuration: "dependency.assets" is not allowed. Please verify it's properly linked using "react-native config" command and contact the package maintainers about this.                Welcome to Metro v0.72.3              Fast - Scalable - Integratederror Unable to resolve module C:\Users\{myusername}\AppData\Roaming\npm\node_modules\react-native\node_modules\metro-runtime\src\modules\empty-module.js from C:\DATA\Projects\iDOL\Code\{myappname}\_:None of these files exist:  * ..\..\..\..\..\Users\{myusername}\AppData\Roaming\npm\node_modules\react-native\node_modules\metro-runtime\src\modules\empty-module.js(.native|.native.js|.js|.native.jsx|.jsx|.native.json|.json|.native.ts|.ts|.native.tsx|.tsx)  * ..\..\..\..\..\Users\{myusername}\AppData\Roaming\npm\node_modules\react-native\node_modules\metro-runtime\src\modules\empty-module.js\index(.native|.native.js|.js|.native.jsx|.jsx|.native.json|.json|.native.ts|.ts|.native.tsx|.tsx).Error: Unable to resolve module C:\Users\{myusername}\AppData\Roaming\npm\node_modules\react-native\node_modules\metro-runtime\src\modules\empty-module.js from C:\DATA\Projects\iDOL\Code\{myappname}\_:None of these files exist:  * ..\..\..\..\..\Users\{myusername}\AppData\Roaming\npm\node_modules\react-native\node_modules\metro-runtime\src\modules\empty-module.js(.native|.native.js|.js|.native.jsx|.jsx|.native.json|.json|.native.ts|.ts|.native.tsx|.tsx)  * ..\..\..\..\..\Users\{myusername}\AppData\Roaming\npm\node_modules\react-native\node_modules\metro-runtime\src\modules\empty-module.js\index(.native|.native.js|.js|.native.jsx|.jsx|.native.json|.json|.native.ts|.ts|.native.tsx|.tsx)    at ModuleResolver.resolveDependency (C:\Users\{myusername}\AppData\Roaming\npm\node_modules\react-native\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:152:15)    at ModuleResolver._getEmptyModule (C:\Users\{myusername}\AppData\Roaming\npm\node_modules\react-native\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:50:26)    at ModuleResolver._getFileResolvedModule (C:\Users\{myusername}\AppData\Roaming\npm\node_modules\react-native\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:219:21)    at ModuleResolver.resolveDependency (C:\Users\{myusername}\AppData\Roaming\npm\node_modules\react-native\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:148:19)    at DependencyGraph.resolveDependency (C:\Users\{myusername}\AppData\Roaming\npm\node_modules\react-native\node_modules\metro\src\node-haste\DependencyGraph.js:264:43)    at Object.resolve (C:\Users\{myusername}\AppData\Roaming\npm\node_modules\react-native\node_modules\metro\src\lib\transformHelpers.js:170:21)    at resolveDependencies (C:\Users\{myusername}\AppData\Roaming\npm\node_modules\react-native\node_modules\metro\src\DeltaBundler\graphOperations.js:466:33)    at processModule (C:\Users\{myusername}\AppData\Roaming\npm\node_modules\react-native\node_modules\metro\src\DeltaBundler\graphOperations.js:232:31)    at runMicrotasks (<anonymous>)    at processTicksAndRejections (internal/process/task_queues.js:93:5)info Run CLI with --verbose flag for more details.
  • The file
    C:\Users\{myusername}\AppData\Roaming\npm\node_modules\react-native\node_modules\metro-runtime\src\modules\empty-module.js
    exits.
  • 回答:
  • 返回列表

    上一篇:

    下一篇:

    发表评论

    访客

    ◎欢迎参与讨论,请在这里发表您的看法和观点。