使用npm安装react-native-gesture-handler时出错

时间:2019-05-14 05:35:54

标签: react-native npm react-navigation npm-install

我正在尝试运行npm install react-native-gesture-handler,但是我的终端给了我这个错误:

SAMETs-MBP:HelloWorld developer$ npm install react-native-gesture-handler
npm ERR! path /Users/developer/HelloWorld/node_modules/react-native-safe-area-view
npm ERR! code EISGIT
npm ERR! git /Users/developer/HelloWorld/node_modules/react-native-safe-area-view: Appears to be a git repo or submodule.
npm ERR! git     /Users/developer/HelloWorld/node_modules/react-native-safe-area-view
npm ERR! git Refusing to remove it. Update manually,
npm ERR! git or move it out of the way first.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/developer/.npm/_logs/2019-05-14T05_27_08_555Z-debug.log

有人可以帮我吗?我在网上搜索,但找不到任何内容。

4 个答案:

答案 0 :(得分:1)

使用纱线。使用 npm 给我一个错误。我尝试使用纱线,它没有出现任何问题。

答案 1 :(得分:1)

我今天也面临着同样的问题。尝试了三个步骤并开始工作!

  1. 手动删除文件夹“ react-native-safe-area-view”
  2. 使用npm start删除缓存---reset-cache
  3. 运行命令npm --save install react-native-gesture-handler

更新:我还发现删除react-native-safe-area-view内部的git文件夹将解决此问题。谢谢@ThaJay

希望这会有所帮助!

答案 2 :(得分:1)

从根文件夹

运行 rm -rf node_modules/*/.git/ 修复了我的问题。参考https://github.com/react-native-community/react-native-safe-area-view/issues/73

答案 3 :(得分:0)

只需删除您的project_dir / node_modules / react-native-safe-area-view 中的 .git 文件夹。 它对我有用。