簡體   English   中英

如何修復 react-native 鏈接 react-native-vector-icons 錯誤

[英]How to fix react-native link react-native-vector-icons error

我想將 react native 矢量圖標鏈接到我的項目。 但是在我輸入react-native link react-native-vector-icons我得到以下信息

warn Calling react-native link [packageName] is deprecated in favor of autolinking. It will be removed in the next major release.
Autolinking documentation: https://github.com/react-native-community/cli/blob/master/docs/autolinking.md
info iOS module "react-native-vector-icons" is already linked
info Linking "react-native-vector-icons" Android dependency
error Linking "react-native-vector-icons" failed. Run CLI with --verbose flag for more details.
Error: ENOENT: no such file or directory, open 'C:\Users\denze\ShoppingList\android\src\main\res\values\strings.xml'
    at Object.openSync (fs.js:457:3)
    at Object.readFileSync (fs.js:359:35)
    at applyPatch (C:\Users\denze\ShoppingList\node_modules\@react-native-community\cli-platform-android\build\link\patches\applyPatch.js:42:51)
    at Object.registerNativeAndroidModule [as register] (C:\Users\denze\ShoppingList\node_modules\@react-native-community\cli-platform-android\build\link\registerNativeModule.js:33:27)
    at C:\Users\denze\ShoppingList\node_modules\react-native\node_modules\@react-native-community\cli\build\commands\link\linkDependency.js:63:16
    at Array.forEach (<anonymous>)
    at linkDependency (C:\Users\denze\ShoppingList\node_modules\react-native\node_modules\@react-native-community\cli\build\commands\link\linkDependency.js:36:32)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async Object.link [as func] (C:\Users\denze\ShoppingList\node_modules\react-native\node_modules\@react-native-community\cli\build\commands\link\link.js:110:5)
    at async Command.handleAction (C:\Users\denze\ShoppingList\node_modules\react-native\node_modules\@react-native-community\cli\build\index.js:186:9)

我已經成功下載了它無法鏈接的軟件包。 我也一直在尋找解決方案,但沒有成功

是的,我遇到了同樣的錯誤。 這可能只是文件位置問題(我不確定)。 至少,我是這么想的。

我將 src 文件夾移到一個目錄上(根據我的錯誤消息),然后重新運行react-native link react-native-vector-icons並且它起作用了。

我不是這個解決方案的粉絲,因為我不確定這會產生什么影響,因為我繼續,我更喜歡一個不要求我只移動(非常重要的)目錄的解決方案,但是,嘿它有效(目前)。

更新

也許一個更優雅的解決方案(目前)是降級您的 react-native 版本(只是說,以防您還沒有嘗試過,或者其他人來了卻沒有嘗試過)。

前任。 package.json

{
   "dependencies": {
     "react": "16.11.0",
     "react-native": "0.61.5",
     "react-native-vector-icons": "^6.6.0"
   }
}

但是是的,這個問題是最近在react-native回購和react-native-community回購中發布的問題。 希望很快能澄清一些事情。

降級 react-native 對我來說是解決之道。 歸功於@izzy3000

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM