Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Cannot find module 'eslint-config-xo' #543

Closed
AndrewMSHowe opened this issue May 10, 2021 · 4 comments · Fixed by #545
Closed

Error: Cannot find module 'eslint-config-xo' #543

AndrewMSHowe opened this issue May 10, 2021 · 4 comments · Fixed by #545

Comments

@AndrewMSHowe
Copy link

AndrewMSHowe commented May 10, 2021

Hi, I wanted to try this out. I installed xo:

$ sudo npm install --global xo
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated

changed 786 packages, and audited 787 packages in 37s

106 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

Then I ran it as described in the readme:

$ xo --help
/usr/lib/node_modules/xo/node_modules/@eslint/eslintrc/lib/shared/relative-module-resolver.js:41
            throw error;
            ^

Error: Cannot find module 'eslint-config-xo'
Require stack:
- /home/andrew/__placeholder__.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
    at Function.resolve (internal/modules/cjs/helpers.js:80:19)
    at resolve (/usr/lib/node_modules/xo/node_modules/@eslint/eslintrc/lib/shared/relative-module-resolver.js:28:50)
    at resolveFrom (/usr/lib/node_modules/xo/lib/options-manager.js:47:66)
    at Object.<anonymous> (/usr/lib/node_modules/xo/lib/options-manager.js:65:4)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/home/andrew/__placeholder__.js' ]
}

It doesn't seem to matter what directory I run it from, either my home dir with no node stuffs or from my project dir. All I have npm installed globally is npm and xo@0.40.0 .

@sindresorhus
Copy link
Member

// @Richienb

@AndrewMSHowe
Copy link
Author

0.40.1 works, thanks.

@AndrewMSHowe
Copy link
Author

AndrewMSHowe commented May 11, 2021

OK well, xo --help works. But in my project folder, xo gives:
Error: Failed to load plugin 'ava' declared in 'BaseConfig » /usr/lib/node_modules/xo/config/plugins.js': Cannot find module 'eslint-plugin-ava'

npm list -g --depth 1 gives (for xo):

└─┬ xo@0.40.1
  ├── @eslint/eslintrc@0.4.1
  ├── @typescript-eslint/eslint-plugin@4.23.0
  ├── @typescript-eslint/parser@4.23.0
  ├── arrify@2.0.1
  ├── cosmiconfig@7.0.0
  ├── debug@4.3.1
  ├── define-lazy-prop@2.0.0
  ├── eslint-config-prettier@8.3.0
  ├── eslint-config-xo-typescript@0.41.1
  ├── eslint-config-xo@0.36.0
  ├── eslint-formatter-pretty@4.0.0
  ├── eslint-import-resolver-webpack@0.13.0
  ├── eslint-plugin-ava@12.0.0
  ├── eslint-plugin-eslint-comments@3.2.0
  ├── eslint-plugin-import@2.22.1
  ├── eslint-plugin-no-use-extend-native@0.5.0
  ├── eslint-plugin-node@11.1.0
  ├── eslint-plugin-prettier@3.4.0
  ├── eslint-plugin-promise@5.1.0
  ├── eslint-plugin-unicorn@32.0.1
  ├── eslint@7.26.0
  ├── find-cache-dir@3.3.1
  ├── find-up@5.0.0
  ├── fs-extra@10.0.0
  ├── get-stdin@8.0.0
  ├── globby@9.2.0
  ├── has-flag@4.0.0
  ├── imurmurhash@0.1.4
  ├── is-path-inside@3.0.3
  ├── json-stable-stringify-without-jsonify@1.0.1
  ├── json5@2.2.0
  ├── lodash@4.17.21
  ├── meow@9.0.0
  ├── micromatch@4.0.4
  ├── open-editor@3.0.0
  ├── p-filter@2.1.0
  ├── p-map@4.0.0
  ├── p-reduce@2.1.0
  ├── path-exists@4.0.0
  ├── prettier@2.3.0
  ├── resolve-cwd@3.0.0
  ├── semver@7.3.5
  ├── slash@3.0.0
  ├── to-absolute-glob@2.0.2
  ├── typescript@4.2.4
  └── update-notifier@5.1.0

So eslint-plugin-ava is there, but something isn't working.

@tusbar
Copy link

tusbar commented May 24, 2021

Related: xojs/vscode-linter-xo#91

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants