Eslint-plugin-import: requires a peer of [email protected] - 4.x but none was installed

Created on 25 Dec 2017  Â·  6Comments  Â·  Source: benmosher/eslint-plugin-import

916 Still happens with 2.8.0...

~/ sudo npm -g update eslint-plugin-import
- [email protected] node_modules/eslint-plugin-import/node_modules/eslint-module-utils/node_modules/ms
- [email protected] node_modules/eslint-plugin-import/node_modules/eslint-module-utils/node_modules/debug
- [email protected] node_modules/eslint-plugin-import/node_modules/object-assign
- [email protected] node_modules/eslint-plugin-import/node_modules/pkg-up
/usr/lib
├── UNMET PEER DEPENDENCY [email protected] - 4.x
└── [email protected] 

npm WARN [email protected] requires a peer of [email protected] - 4.x but none was installed.
~/ sudo npm -g list eslint eslint-plugin-import
/usr/lib
├── [email protected] 
└── [email protected] 



md5-070eae3e042921a4636fd048a6af1971



~/ sudo npm -g view eslint-plugin-import

{ name: 'eslint-plugin-import',
  description: 'Import with sanity.',
  'dist-tags': { latest: '2.8.0', next: '2.0.0-beta.1' },
  versions: 
......
question

Most helpful comment

They’ve already removed respecting the “preferGlobal” option, for exactly this reason.

You don’t have to follow best practices, but none the less, global installs are a bad practice, full stop.

Also, anything with peer deps is a nightmare to globally install, as you discovered.

All 6 comments

After doing sudo npm -g install semver it seems to have gone :confused:

In general, things shouldn't be installed globally, especially linters like eslint and their plugins (since these are per-project tools). Glad you figured it out.

@ljharb , in contrary those that you mentioned are commonly used by many projects and thus warrant a global install.
Unless you're the kind that believes the shell is also per user and should be installed per user ...doh...
anyway, i think you guys should mention a fix for this problem in some documentation of your install guides...
cheers

No, used by 1000 projects means you should have 1000 local installs - that way each project as all its dependencies easily reproducible, and version-tracked.

In general, nothing should be globally installed.

LMFAO, then go persuade the node+npm makers to remove the option to install globally...

/signoff from thread

They’ve already removed respecting the “preferGlobal” option, for exactly this reason.

You don’t have to follow best practices, but none the less, global installs are a bad practice, full stop.

Also, anything with peer deps is a nightmare to globally install, as you discovered.

Was this page helpful?
0 / 5 - 0 ratings