尝试运行将x-resources包作为依赖项的 react-native 项目,使用 yarn 安装了依赖项,但是当我尝试运行该项目时,我在运行时收到此错误
bundling failed: Error: While trying to resolve module `x-resources` from file `/***/index.js`, the package `/***/node_modules/x-resources/package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`/***/node_modules/x-resources/dist/index.js`. Indeed, none of these files exist:
* /***/node_modules/x-resources/dist/index.js(.native|.ios.js|.native.js|.js|.ios.json|.native.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx)
* /***/node_modules/x-resources/dist/index.js/index(.native|.ios.js|.native.js|.js|.ios.json|.native.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx)
at ResolutionRequest.resolveDependency (/***/node_modules/metro/src/node-haste/DependencyGraph/ResolutionRequest.js:65:15)
at DependencyGraph.resolveDependency (/***/node_modules/metro/src/node-haste/DependencyGraph.js:282:16)
at Object.resolve (/***/node_modules/metro/src/lib/transformHelpers.js:267:42)
at /***/node_modules/metro/src/DeltaBundler/traverseDependencies.js:426:31
at Array.map (<anonymous>)
at resolveDependencies (/***/node_modules/metro/src/DeltaBundler/traverseDependencies.js:423:18)
at /***/node_modules/metro/src/DeltaBundler/traverseDependencies.js:275:33
at Generator.next (<anonymous>)
at asyncGeneratorStep (/***/node_modules/metro/src/DeltaBundler/traverseDependencies.js:87:24)
at _next (/***/node_modules/metro/src/DeltaBundler/traverseDependencies.js:107:9)
这个包中没有/dist文件夹,我不明白为什么它在里面寻找 index.js,我不知道这是与地铁相关的问题还是特定于这个包,我已经尝试关闭运行js服务器多次但没有运气。
反应:16.9.0
反应原生:0.61.4
x资源:1.1.2
axios:0.19.0