【问题标题】:Error when installing react-native-gesture-handler with npm使用 npm 安装 react-native-gesture-handler 时出错
【发布时间】:2019-10-01 01:54:20
【问题描述】:

我正在尝试运行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

谁能帮我解决这个问题?我在网上搜索,但没有找到任何东西。

【问题讨论】:

  • 删除你的 node_module 文件夹然后使用 npm i
  • 我做到了。我在尝试运行 npm i 时收到同样的错误
  • @SametMutevelli 删除你的 node_module 和 package-lock.json,清除你的 npm 缓存,然后运行 ​​npm install,还有你使用的 react-native 版本是什么
  • @SametMutevelli 我得到了同样的错误!你解决了这个问题吗?如果是,请分享您的答案

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


【解决方案1】:

使用纱线。使用 npm 给了我一个错误。我用 yarn 试过了,没有任何问题。

【讨论】:

    【解决方案2】:

    我今天遇到了同样的问题。试了三个步骤,成功了!

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

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

    希望对您有所帮助!

    【讨论】:

    • 你只需要删除react-native-safe-area-view里面的.git文件夹。
    【解决方案3】:

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

    【讨论】:

      【解决方案4】:

      从根文件夹运行 rm -rf node_modules/*/.git/ 解决了我的问题。参考https://github.com/react-native-community/react-native-safe-area-view/issues/73

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2021-01-03
        • 2021-03-25
        • 2019-11-15
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2022-06-27
        • 1970-01-01
        相关资源
        最近更新 更多