[email protected] not working unless installed locally

Created on 26 Sep 2019  路  14Comments  路  Source: xojs/xo

I always keep xo installed globally so I can usually run lint without running npm install on the local repo. This does not work for me after updating my global install to 0.25.3:

$ npm i -g xo
$ rm -fr node_modules
$ xo
Error: Failed to load config "xo/esnext" to extend from.
Referenced from: BaseConfig
    at configMissingError (/home/cfarrell/.nvm/versions/node/v12.10.0/lib/node_modules/xo/node_modules/eslint/lib/cli-engine/config-array-factory.js:233:9)
    at ConfigArrayFactory._loadExtendedShareableConfig (/home/cfarrell/.nvm/versions/node/v12.10.0/lib/node_modules/xo/node_modules/eslint/lib/cli-engine/config-array-factory.js:712:23)
    at ConfigArrayFactory._loadExtends (/home/cfarrell/.nvm/versions/node/v12.10.0/lib/node_modules/xo/node_modules/eslint/lib/cli-engine/config-array-factory.js:617:25)
    at ConfigArrayFactory._normalizeObjectConfigDataBody (/home/cfarrell/.nvm/versions/node/v12.10.0/lib/node_modules/xo/node_modules/eslint/lib/cli-engine/config-array-factory.js:547:25)
    at _normalizeObjectConfigDataBody.next (<anonymous>)
    at ConfigArrayFactory._normalizeObjectConfigData (/home/cfarrell/.nvm/versions/node/v12.10.0/lib/node_modules/xo/node_modules/eslint/lib/cli-engine/config-array-factory.js:491:20)
    at _normalizeObjectConfigData.next (<anonymous>)
    at createConfigArray (/home/cfarrell/.nvm/versions/node/v12.10.0/lib/node_modules/xo/node_modules/eslint/lib/cli-engine/config-array-factory.js:307:25)
    at ConfigArrayFactory.create (/home/cfarrell/.nvm/versions/node/v12.10.0/lib/node_modules/xo/node_modules/eslint/lib/cli-engine/config-array-factory.js:362:16)
    at createBaseConfigArray (/home/cfarrell/.nvm/versions/node/v12.10.0/lib/node_modules/xo/node_modules/eslint/lib/cli-engine/cascading-config-array-factory.js:84:48)

This seems to be caused by eslint@6, see https://eslint.org/docs/user-guide/migrating-to-6.0.0#-plugins-and-shareable-configs-are-no-longer-affected-by-eslints-location

bug help wanted

Most helpful comment

I ran into the same issue with a global xo installation.

@coreyfarrell was right on point with his initial assessment:

This seems to be caused by eslint@6

To add another quote from ESLint's migration guide:

If you use a global installation of ESLint (e.g. installed with npm install eslint --global) along with plugins, you should install those plugins locally in the projects where you run ESLint. [...]

I got it to work after locally installing the required configs/plugins:

npm i -D eslint-config-xo

There are likely other missing packages, e.g. eslint-plugin-import etc. - They all need to be available locally.

The reason why [email protected] still works is because it uses ESLint 5. [email protected] and later uses ESLint 6.

All 14 comments

Unrelated note while inspecting my global install I noticed some .DS_Store files leaked into the npm publish of xo and related modules.

0.25.2 does not have this issue. So it was introduced in the last version

@rizowski Thanks for the suggestion however I just ran npm i -g [email protected] and still have the issue. I verified the correct version was installed globally.

Oh my mistake. I have a similar error but it is around loading the plugin unicorn from the BaseConfig. That error goes away when I go back a version. I also have XO installed locally, I wouldn't think that would matter too much.

I'm experiencing this even when xo installed locally on a project. Is there a temporary fix?

Same issue here :-(

yeah rolling back to 0.25.2 fixes it for now.

I have the same issue, both with the latest version and with 0.25.2

Rolling back to 0.24.x fixed it for me

Some testing around some of these base-config errors I've noticed that removing your node_modules and reinstalling after an upgrade can help fix this issue.

Can reproduce, xo v0.28.0

Error: Failed to load config "xo/esnext" to extend from.
Referenced from: BaseConfig
    at configMissingError (C:\Projects\Classified\ems\node_modules\.pnpm\registry.npmjs.org\eslint\6.8.0\node_modules\eslint\lib\cli-engine\config-array-factory.js:265:9)
    at ConfigArrayFactory._loadExtendedShareableConfig (C:\Projects\Classified\ems\node_modules\.pnpm\registry.npmjs.org\eslint\6.8.0\node_modules\eslint\lib\cli-engine\config-array-factory.js:826:23)
    at ConfigArrayFactory._loadExtends (C:\Projects\Classified\ems\node_modules\.pnpm\registry.npmjs.org\eslint\6.8.0\node_modules\eslint\lib\cli-engine\config-array-factory.js:731:25)
    at ConfigArrayFactory._normalizeObjectConfigDataBody (C:\Projects\Classified\ems\node_modules\.pnpm\registry.npmjs.org\eslint\6.8.0\node_modules\eslint\lib\cli-engine\config-array-factory.js:660:25)
    at _normalizeObjectConfigDataBody.next (<anonymous>)
    at ConfigArrayFactory._normalizeObjectConfigData (C:\Projects\Classified\ems\node_modules\.pnpm\registry.npmjs.org\eslint\6.8.0\node_modules\eslint\lib\cli-engine\config-array-factory.js:596:20)
    at _normalizeObjectConfigData.next (<anonymous>)
    at createConfigArray (C:\Projects\Classified\ems\node_modules\.pnpm\registry.npmjs.org\eslint\6.8.0\node_modules\eslint\lib\cli-engine\config-array-factory.js:340:25)
    at ConfigArrayFactory.create (C:\Projects\Classified\ems\node_modules\.pnpm\registry.npmjs.org\eslint\6.8.0\node_modules\eslint\lib\cli-engine\config-array-factory.js:395:16)
    at createBaseConfigArray (C:\Projects\Classified\ems\node_modules\.pnpm\registry.npmjs.org\eslint\6.8.0\node_modules\eslint\lib\cli-engine\cascading-config-array-factory.js:86:48)

PS: I use pnpm, and I tried removing node_modules and reinstalling, it is installed both locally and globally

I ran into the same issue with a global xo installation.

@coreyfarrell was right on point with his initial assessment:

This seems to be caused by eslint@6

To add another quote from ESLint's migration guide:

If you use a global installation of ESLint (e.g. installed with npm install eslint --global) along with plugins, you should install those plugins locally in the projects where you run ESLint. [...]

I got it to work after locally installing the required configs/plugins:

npm i -D eslint-config-xo

There are likely other missing packages, e.g. eslint-plugin-import etc. - They all need to be available locally.

The reason why [email protected] still works is because it uses ESLint 5. [email protected] and later uses ESLint 6.

$ xo --version
0.36.1

$ xo
Error: Failed to load config "xo/esnext" to extend from.
Referenced from: BaseConfig
    at configMissingError (/usr/local/lib/node_modules/xo/node_modules/@eslint/eslintrc/lib/config-array-factory.js:289:9)
    at ConfigArrayFactory._loadExtendedShareableConfig (/usr/local/lib/node_modules/xo/node_modules/@eslint/eslintrc/lib/config-array-factory.js:877:23)
    at ConfigArrayFactory._loadExtends (/usr/local/lib/node_modules/xo/node_modules/@eslint/eslintrc/lib/config-array-factory.js:780:25)
    at ConfigArrayFactory._normalizeObjectConfigDataBody (/usr/local/lib/node_modules/xo/node_modules/@eslint/eslintrc/lib/config-array-factory.js:719:25)
    at _normalizeObjectConfigDataBody.next (<anonymous>)
    at ConfigArrayFactory._normalizeObjectConfigData (/usr/local/lib/node_modules/xo/node_modules/@eslint/eslintrc/lib/config-array-factory.js:664:20)
    at _normalizeObjectConfigData.next (<anonymous>)
    at ConfigArrayFactory.create (/usr/local/lib/node_modules/xo/node_modules/@eslint/eslintrc/lib/config-array-factory.js:459:16)
    at createBaseConfigArray (/usr/local/lib/node_modules/xo/node_modules/@eslint/eslintrc/lib/cascading-config-array-factory.js:98:48)
    at new CascadingConfigArrayFactory (/usr/local/lib/node_modules/xo/node_modules/@eslint/eslintrc/lib/cascading-config-array-factory.js:234:30)
Was this page helpful?
0 / 5 - 0 ratings

Related issues

haskellcamargo picture haskellcamargo  路  3Comments

sindresorhus picture sindresorhus  路  3Comments

niftylettuce picture niftylettuce  路  6Comments

sindresorhus picture sindresorhus  路  5Comments

sindresorhus picture sindresorhus  路  6Comments