安装npm react-navigation时出错

时间:2018-04-07 19:06:20

标签: reactjs react-native

我正在尝试使用命令

在我的项目中安装npm react navigation
npm install --save react-navigation

当我尝试执行命令时,出现错误说:

 npm ERR! fatal: 'submodule' appears to be a git command, but we were not
 npm ERR! able to execute it. Maybe git-submodule is broken?

我已经在我的环境变量中放置了Git的路径。以下是错误的屏幕截图:

enter image description here

我在环境变量中添加的路径如下:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\cmd

我不知道如何摆脱这个错误。我只是在用户按下应用程序中的按钮时尝试导航到另一个页面。

<View>
  <TouchableHighlight style={styles.button}>
                <Text style={styles.buttonText}>Test</Text>
            </TouchableHighlight>
</View>

非常感谢任何帮助。

2 个答案:

答案 0 :(得分:0)

由于该库是基于JS的解决方案,要安装最新版本的react-navigation,您只需要运行:

yarn add react-navigation

npm install --save react-navigation

我希望这会有所帮助。

答案 1 :(得分:0)

我成功地安装了react-navigation。我所要做的就是执行这个命令:

npm install --save react-navigation@1.5.2

子模块错误消失。我不确定为什么把版本号修复错误,但现在它正在工作。