[email protected] requires a peer of webpack@2 || 3 but none was installed

Noman Ali picture Noman Ali · Oct 14, 2017 · Viewed 12.2k times · Source

I am having this issue while installing all node_modules. And this is making me crazy.

[email protected] requires a peer of webpack@2 || 3 but none was installed.

Here is my package.json file

{
  "name": "react-router-firebase-auth",
  "version": "0.1.0",
  "private": true,
  "devDependencies": {
    "babel-core": "^6.26.0",
    "babel-loader": "^7.1.2",
    "babel-plugin-transform-es2015-modules-commonjs": "^6.26.0",
    "babel-preset-es2015": "^6.24.1",
    "babel-preset-react": "^6.24.1",
    "react-scripts": "0.9.5"
  },
  "dependencies": {
    "@atlaskit/button": "3.0.0",
    "@atlaskit/css-reset": "1.1.4",
    "@atlaskit/field-text": "4.0.1",
    "@atlaskit/modal-dialog": "2.1.1",
    "@atlaskit/page": "4.0.1",
    "@atlaskit/util-shared-styles": "2.3.1",
    "@shopify/polaris": "^1.5.1",
    "babel-eslint": "^7.0.0",
    "bootstrap": "^3.3.7",
    "eslint": "3.16.1",
    "eslint-plugin-react": "6.4.1",
    "express": "^4.16.1",
    "firebase": "^4.5.0",
    "firebase-admin": "^5.4.1",
    "firestore": "^1.1.6",
    "fixed-data-table": "^0.6.4",
    "griddle-react": "^1.8.1",
    "jquery": "^3.2.1",
    "node-localstorage": "^1.3.0",
    "nodemon": "^1.12.1",
    "react": "^15.5.3",
    "react-bootstrap": "^0.31.3",
    "react-bootstrap-button-loader": "^1.0.8",
    "react-bootstrap-navbar": "^1.1.0",
    "react-data-grid": "^2.0.59",
    "react-date-picker": "^6.1.2",
    "react-dom": "^15.5.3",
    "react-fontawesome": "^1.6.1",
    "react-router-dom": "^4.0.0-beta.8",
    "react-scripts": "^0.9.5",
    "react-transition-group": "^1.2.0",
    "reactstrap": "^4.8.0",
    "requestify": "^0.2.5",
    "simple-react-bootstrap": "^0.2.7",
    "styled-components": "1.4.6",
    "url": "^0.11.0"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject"
  }
}

I am using create-react-app for this project. So i could not change webpack.config.js file. What am i supposed to do here?

Answer

Daniel picture Daniel · Oct 14, 2017

Please read this post. It describes what a peer dependency is.

https://stackoverflow.com/a/34645112/2379376

What that means is that you have webpack not installed at all or you have a different version (webpack 1.x) installed. But this plugin needs webpack in version 2 or 3 to function properly.

What you can do is

npm install webpack -g

So npm will install the newest version of webpack on your system. But now other peer warnings could occur when other loaders need an older version of webpack.