0

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  
├─┬ [email protected]  
│ ├─┬ [email protected]   
│ │ ├── [email protected]   
│ │ └── [email protected]   
│ ├── [email protected]   
│ ├── [email protected]   
│ ├─┬ [email protected]   
│ │ └─┬ [email protected]   
│ │   └── [email protected]   
│ ├── [email protected]   
│ ├── UNMET PEER DEPENDENCY react@>=0.14.0  
│ ├── UNMET PEER DEPENDENCY react-dom@>=0.14.0  
│ ├─┬ [email protected]   
│ │ └── UNMET PEER DEPENDENCY react@>=0.14.0  
│ ├── [email protected]   
│ ├── [email protected]   
│ └── [email protected]   
└── UNMET PEER DEPENDENCY react-dom@>=0.14.0  

npm WARN enoent ENOENT: no such file or directory, open '/Users/../../package.json'  
npm WARN [email protected] requires a peer of react@>=0.14.0 but none was installed.  
npm WARN [email protected] requires a peer of react-dom@>=0.14.0 but none was installed.  
npm WARN [email protected] requires a peer of react@>=0.14.0 but none was installed.  
npm WARN [email protected] requires a peer of react-dom@>=0.14.0 but none was installed.  
npm WARN [email protected] requires a peer of react@>=0.11.0 but none was installed.  
npm WARN [email protected] requires a peer of react@>=0.14.0 but none was installed.  

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.")

2 Answers 2

1

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

Sign up to request clarification or add additional context in comments.

Comments

1

Yes you will need to install react and react-dom separately. A peer dependency is one that the package you're installing assumes to already be installed.

The behaviour changed in npm 3 to simply warn of those that are missing.

npm install react react-dom react-bootstrap --save

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.