➜ beslint git:(master) ✗ eslint -v
v3.15.0
➜ beslint git:(master) ✗ npm install -g eslint-config-airbnb eslint-plugin-jsx-a11y eslint-plugin-import eslint-plugin-react
/Users/next/.nvm/versions/node/v7.5.0/lib
├── UNMET PEER DEPENDENCY eslint@^3.15.0
├─┬ [email protected]
│ └── UNMET PEER DEPENDENCY eslint@^3.15.0
├── [email protected]
├── [email protected]
└── [email protected]
npm WARN [email protected] requires a peer of eslint@^3.15.0 but none was installed.
npm WARN [email protected] requires a peer of eslint@^3.15.0 but none was installed.
npm WARN [email protected] requires a peer of [email protected] - 3.x but none was installed.
npm WARN [email protected] requires a peer of eslint@^2.10.2 || 3.x but none was installed.
npm WARN [email protected] requires a peer of eslint@^2.0.0 || ^3.0.0 but none was installed.
➜ beslint git:(master) ✗
- I tired to install globally
- I use nvm to install
node 7.5.0
, and installed eslint globally. - when I try to install
eslint-config-airbnb
globally. - It said
UNMET PEER DEPENDENCY
➜ beslint git:(master) ✗ eslint -v
v3.15.0
➜ beslint git:(master) ✗ npm install -g eslint-config-airbnb eslint-plugin-jsx-a11y eslint-plugin-import eslint-plugin-react
/Users/next/.nvm/versions/node/v7.5.0/lib
├── UNMET PEER DEPENDENCY eslint@^3.15.0
├─┬ [email protected]
│ └── UNMET PEER DEPENDENCY eslint@^3.15.0
├── [email protected]
├── [email protected]
└── [email protected]
npm WARN [email protected] requires a peer of eslint@^3.15.0 but none was installed.
npm WARN [email protected] requires a peer of eslint@^3.15.0 but none was installed.
npm WARN [email protected] requires a peer of [email protected] - 3.x but none was installed.
npm WARN [email protected] requires a peer of eslint@^2.10.2 || 3.x but none was installed.
npm WARN [email protected] requires a peer of eslint@^2.0.0 || ^3.0.0 but none was installed.
➜ beslint git:(master) ✗
- I tired to install globally
- I use nvm to install
node 7.5.0
, and installed eslint globally. - when I try to install
eslint-config-airbnb
globally. - It said
UNMET PEER DEPENDENCY
- Have you tried... installing the dependency? – Tomalak Commented Feb 17, 2017 at 2:42
- Does the WARN shows what I have to install exactly the peer ? I thought I already installed the eslint globally that will MEET the requirements. Am I wrong? – Liuuil Commented Feb 17, 2017 at 3:00
5 Answers
Reset to default 5You can install eslint-config-airbnb-bundle
. This is an unaltered Airbnb style guide config bundled with ESLint in a single package to solve some inconvenience with the installation (like unmet peer dependency warnings). You can install it globally as well:
npm i -g eslint-config-airbnb-bundle
Airbnb only: https://www.npmjs./package/eslint-config-airbnb-bundle
Airbnb + Standard: https://www.npmjs./package/eslint-config-airbnb-standard
I faced similar issue but found a solution to this issue. I thought its worth sharing.
To install the correct versions of each package related eslint config , You can run following mand :
npm info "eslint-config-airbnb@latest" peerDependencies
You can get exact peer dependency which are listed by running above mand:
e.g about outputs ( as of answer's date ) will produce following :
{ eslint: '^3.19.0 || ^4.3.0',
'eslint-plugin-jsx-a11y': '^5.1.1',
'eslint-plugin-import': '^2.7.0',
'eslint-plugin-react': '^7.1.0'
}
From above output you can exact idea about what dependencies to install for current ( latest build) .
If you want to install all dependencies in one go ( for Linux/OSX users only) Use below mand :
(
export PKG=eslint-config-airbnb;
npm info "$PKG@latest" peerDependencies --json | mand sed 's/[\{\},]//g ; s/: /@/g' | xargs npm install --save-dev "$PKG@latest"
)
More details here.
From https://www.npmjs./package/eslint-config-airbnb
npx install-peerdeps --dev eslint-config-airbnb
I don't think you should install everything global. Try this:
npm install --save-dev eslint eslint-config-airbnb eslint-plugin-jsx-a11y eslint-plugin-import eslint-plugin-react
Removing node modules (rm -rf node_modules/
) and re-running npm install
worked for me!!