为什么我在react-native项目中无法使用npm安装native-base?

时间:2019-05-14 10:25:36

标签: react-native npm install native-base

npm install native-base --save

我遇到此错误:

npm WARN registry Unexpected warning for https://registry.npmjs.org/: Miscellaneous Warning ENETUNREACH: request to https://registry.npmjs.org/react-native-keyboard-aware-scroll-view failed, reason: connect ENETUNREACH 104.16.22.35:443
npm WARN registry Using stale data from https://registry.npmjs.org/ due to a request error during revalidation.
npm ERR! path /Users/.../node_modules/react-native-safe-area-view
npm ERR! code EISGIT

npm ERR! git /Users/.../node_modules/react-native-safe-area-view: Appears to be a git repo or submodule.
npm ERR! git     /Users/.../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/.../.npm/_logs/2019-05-14T10_13_00_776Z-debug.log

1 个答案:

答案 0 :(得分:0)

此问题通常有时会发生,作为临时解决方法,请按照以下步骤操作:

  1. 在node_modules目录中删除此文件夹

    C:\Users\...\node_modules\react-native-safe
        -area-view
    
  2. 安装要再次添加的软件包。

    npm install native-base --save
    

那应该可以解决问题。