React-native link is not working properly

孤者浪人 提交于 2021-01-27 04:19:54

问题


I tried installing and linking react-native sound into my project. However, when I run the following command in my project directory,

react-native link react-native-sound

the library doesn't link and I get the following result:

Scanning 758 folders for symlinks in /Users/MY_USER_NAME/PROJECT_NAME/node_modules 

I think my node or npm setup is wrong.


回答1:


Ok after some digging, I found the issue. https://github.com/facebook/react-native/pull/14863

Maybe try applying that fix locally, it should work then.




回答2:


I had the same issue in linking a npm package, I closed the react native android project in android studio (where I was linking the npm repo), It worked fine for me.




回答3:


1- create new file in project root and name it react-native.config.js

2- add this code to react-native.config.js :

    module.exports = {
    project: {
      ios: {},
      android: {},
    },
    assets: ['./src/assets/fonts/'],
  };

3- change ['./src/assets/fonts/'] to your fonts path

4- now run react-native link

thats it



来源:https://stackoverflow.com/questions/44751936/react-native-link-is-not-working-properly

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!