➜ 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
├─┬ eslint-config-airbnb@14.1.0
│ └── UNMET PEER DEPENDENCY eslint@^3.15.0
├── eslint-plugin-import@2.2.0
├── eslint-plugin-jsx-a11y@4.0.0
└── eslint-plugin-react@6.10.0
npm WARN eslint-config-airbnb@14.1.0 requires a peer of eslint@^3.15.0 but none was installed.
npm WARN eslint-config-airbnb-base@11.1.0 requires a peer of eslint@^3.15.0 but none was installed.
npm WARN eslint-plugin-import@2.2.0 requires a peer of eslint@2.x - 3.x but none was installed.
npm WARN eslint-plugin-jsx-a11y@4.0.0 requires a peer of eslint@^2.10.2 || 3.x but none was installed.
npm WARN eslint-plugin-react@6.10.0 requires a peer of eslint@^2.0.0 || ^3.0.0 but none was installed.
➜ beslint git:(master) ✗
node 7.5.0
, and installed eslint globally. eslint-config-airbnb
globally. UNMET PEER DEPENDENCY
You 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.com/package/eslint-config-airbnb-bundle
Airbnb + Standard: https://www.npmjs.com/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 command :
npm info "eslint-config-airbnb@latest" peerDependencies
You can get exact peer dependency which are listed by running above command:
eg 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 command :
(
export PKG=eslint-config-airbnb;
npm info "$PKG@latest" peerDependencies --json | command sed 's/[\{\},]//g ; s/: /@/g' | xargs npm install --save-dev "$PKG@latest"
)
More details here .
来自https://www.npmjs.com/package/eslint-config-airbnb
npx install-peerdeps --dev eslint-config-airbnb
删除节点模块( rm -rf node_modules/
)并重新运行npm install
对我rm -rf node_modules/
!!
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.