React native 如何安装本机矢量图标?

React native 如何安装本机矢量图标?,react-native,React Native,我尝试了我能找到的所有资源 ,以及关于堆栈溢出的许多其他问题 但是我不能让它工作 我第一次使用 react-native init myapp 命令启动项目并按照github页面上的说明安装react原生向量图标 我已经像这样引进了这个家庭 import Icon from 'react-native-vector-icons/FontAwesome'; 但当我运行这个应用程序时,我在android和ios上都会遇到这个错误 安卓上 The development server return

我尝试了我能找到的所有资源

,以及关于堆栈溢出的许多其他问题 但是我不能让它工作

我第一次使用

react-native init myapp
命令启动项目并按照github页面上的说明安装react原生向量图标

我已经像这样引进了这个家庭

import Icon from 'react-native-vector-icons/FontAwesome';
但当我运行这个应用程序时,我在android和ios上都会遇到这个错误

安卓上

The development server returned response error code: 500

URL: http://10.0.2.2:8081/index.delta?platform=android&dev=true&minify=false

Body:
{"type":"InternalError","errors":[],"message":"Metro Bundler has encountered an internal error, please check your terminal error output for more details"}
processBundleResult
    BundleDownloader.java:242
access$100
    BundleDownloader.java:41
onResponse
    BundleDownloader.java:208
execute
    RealCall.java:135
run
    NamedRunnable.java:32
runWorker
    ThreadPoolExecutor.java:1112
run
    ThreadPoolExecutor.java:587
run
    Thread.java:818
在iOS上

Failed to load bundle(http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false) with error:(Metro Bundler has encountered an internal error, please check your terminal error output for more details (null))

__38-[RCTCxxBridge loadSource:onProgress:]_block_invoke.242
    RCTCxxBridge.mm:419
___ZL36attemptAsynchronousLoadOfBundleAtURLP5NSURLU13block_pointerFvP18RCTLoadingProgressEU13block_pointerFvP7NSErrorP9RCTSourceE_block_invoke.118
__80-[RCTMultipartDataTask URLSession:streamTask:didBecomeInputStream:outputStream:]_block_invoke
-[RCTMultipartStreamReader emitChunk:headers:callback:done:]
-[RCTMultipartStreamReader readAllPartsWithCompletionCallback:progressCallback:]
-[RCTMultipartDataTask URLSession:streamTask:didBecomeInputStream:outputStream:]
__88-[NSURLSession delegate_streamTask:didBecomeInputStream:outputStream:completionHandler:]_block_invoke
__NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__
-[NSBlockOperation main]
-[__NSOperationInternal _start:]
_dispatch_client_callout
_dispatch_block_invoke_direct
_dispatch_client_callout
_dispatch_block_invoke_direct
dispatch_block_perform
__NSOQSchedule_f
_dispatch_client_callout
_dispatch_continuation_pop
_dispatch_async_redirect_invoke
_dispatch_root_queue_drain
_dispatch_worker_thread3
_pthread_wqthread
start_wqthread
在调试控制台上,我得到了这个错误

deltaUrlToBlobUrl.js:31 GET http://localhost:8081/index.delta?platform=android&dev=true&minify=false 500 (Internal Server Error)

DeltaPatcher.js:58 Uncaught (in promise) Error: DeltaPatcher should receive a fresh Delta when being initialized
at DeltaPatcher.applyDelta (DeltaPatcher.js:58)
at deltaUrlToBlobUrl (deltaUrlToBlobUrl.js:34)
at <anonymous>
deltaultobloburl.js:31获取http://localhost:8081/index.delta?platform=android&dev=true&minify=false 500(内部服务器错误)
js:58未捕获(承诺中)错误:DeltaPatcher在初始化时应收到新的增量
在DeltaPatcher.applyDelta(DeltaPatcher.js:58)
在Deltaurltobul(deltaurltobul.js:34)
在

如果我能让它工作,我将非常高兴。提前谢谢。

我终于找到了解决办法

这仅在react原生版本0.52.0中发生 它试图查找的文件实际上声明了该模块。文件搜索的顺序在最近的版本中发生了一些变化

试试这个

rm ./node_modules/react-native/local-cli/core/__fixtures__/files/package.json

使用npm您可以轻松地安装它。请在根文件夹中遵循以下常见命令:

* npm install react-native-vector-icons
* react-native link

确保链接
react native vector图标
,重新安装应用程序并仔细阅读文档。我也这么做过!