我是否需要在安装 react-bootstrap 之前安装 React [英] Do I need to install React before I install react-bootstrap

查看:40
本文介绍了我是否需要在安装 react-bootstrap 之前安装 React的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试安装 react-bootstrap.当我运行命令时

I am trying to install react-bootstrap. When I run the command

npm install react-bootstrap --save

我得到以下信息(一些路径名替换为..."):

I get the following (some path names replaced with '...') :

npm WARN saveError ENOENT: no such file or directory, open '/Users/../package.json'/Users/.../..

├── UNMET PEER DEPENDENCY react@>=0.14.0  
├─┬ react-bootstrap@0.30.7  
│ ├─┬ babel-runtime@6.20.0   
│ │ ├── core-js@2.4.1   
│ │ └── regenerator-runtime@0.10.1   
│ ├── classnames@2.2.5   
│ ├── dom-helpers@2.4.0   
│ ├─┬ invariant@2.2.2   
│ │ └─┬ loose-envify@1.3.0   
│ │   └── js-tokens@2.0.0   
│ ├── keycode@2.1.8   
│ ├── UNMET PEER DEPENDENCY react@>=0.14.0  
│ ├── UNMET PEER DEPENDENCY react-dom@>=0.14.0  
│ ├─┬ react-overlays@0.6.10   
│ │ └── UNMET PEER DEPENDENCY react@>=0.14.0  
│ ├── react-prop-types@0.4.0   
│ ├── uncontrollable@4.0.3   
│ └── warning@3.0.0   
└── UNMET PEER DEPENDENCY react-dom@>=0.14.0  

npm WARN enoent ENOENT: no such file or directory, open '/Users/../../package.json'  
npm WARN react-bootstrap@0.30.7 requires a peer of react@>=0.14.0 but none was installed.  
npm WARN react-bootstrap@0.30.7 requires a peer of react-dom@>=0.14.0 but none was installed.  
npm WARN react-overlays@0.6.10 requires a peer of react@>=0.14.0 but none was installed.  
npm WARN react-overlays@0.6.10 requires a peer of react-dom@>=0.14.0 but none was installed.  
npm WARN uncontrollable@4.0.3 requires a peer of react@>=0.11.0 but none was installed.  
npm WARN react-prop-types@0.4.0 requires a peer of react@>=0.14.0 but none was installed.  

我是否需要在安装 react-bootstrap 之前安装 React ?我在 doc 中没有看到任何具体提及.(我是 React 的新手,如果我使用 react-bootstrap,我什至不知道我也需要 React.我认为它也包含 React.但是在同一 doc 稍后:如果你安装了 React 和 React-Bootstrap,你就拥有了你需要的一切.")

Do I need to install React before I install react-bootstrap? I don't see any specific mention of it in the doc. (I am new to React and didn't even know that I need React also if I am using react-bootstrap. I thought it included React as well. But saw this mentioned in the Javascript section of the same doc later: "If you have React setup and React-Bootstrap installed you have everything you need.")

推荐答案

在 React 生态系统中,您应该始终先安装 react + react-dom.一般不要依赖对等依赖.

In the React ecosystem, you should always install react + react-dom first. Don't rely on peer dependencies in general.

这篇关于我是否需要在安装 react-bootstrap 之前安装 React的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆