【发布时间】:2016-04-20 08:52:43
【问题描述】:
我的一般问题:我为 react-native Android 构建了一个原生组件。它有自己的依赖关系等。我按照说明编辑 package.json,删除了 react-native 的依赖项,现在正在测试包。对于 react-native 的包,有什么具体要遵循的吗?
我得到的错误/警告:
假设我正在构建的模块名为react-native-mymodule。
我运行的命令:
$ npm install react-native-mymodule $ rnpm link react-native-mymodule
运行react-native run-android时,在:react-native-mymodule:bundleReleaseJsAndAssets这一步会抛出以下错误:
module.js:341
throw err;
^
Error: Cannot find module '/path/to/my/test/project/node_modules/react-native-mymodule/node_modules/react-native/local-cli/cli.js'
at Function.Module._resolveFilename (module.js:339:15)
at Function.Module._load (module.js:290:25)
at Function.Module.runMain (module.js:447:10)
at startup (node.js:146:18)
at node.js:404:3
:react-native-mymodule:bundleReleaseJsAndAssets FAILED
这是否意味着,我必须为我的原生模块生成一个签名的 APK?如果是这样,为什么在创建原生模块时需要这样做?
我另外四次收到以下警告:
WARNING: Dependency test_project:react-native-mymodule:unspecified on project app resolves to an APK archive which is not supported as a compilation dependency. File: /path/to/my/test_project/node_modules/react-native-mymodule/android/app/build/outputs/apk/react-native-mymodule-release-unsigned.apk
到目前为止,我在网络和 react-native 文档中的搜索均未成功。
【问题讨论】:
标签: android npm react-native