Ramya
Ramya

Reputation: 57

After running npm i --save react-router-dom i am getting error

I am getting the error shown below after running the react-router-dom command how to fix this?

./node_modules/create-react-context/lib/implementation.js Module not found: Can't resolve 'react' in 'C:\xampp\htdocs\learn-router\node_modules\create-react-context\lib'

Upvotes: 1

Views: 1466

Answers (2)

Amruth
Amruth

Reputation: 5912

Add react-router-dom directly to dependencies list in package.json file.

"react-router-dom": "^4.3.1",

then run below command in your project root directory.

npm install

enter image description here

Upvotes: 0

Srinivas
Srinivas

Reputation: 1556

you have to install react first before installing react-router-dom package,

try this:

 rm -rf node_modules
 npm i react react-router-dom --save

Upvotes: 1

Related Questions