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: Failed to load plugin 'unicorn' declared in 'BaseConfig » /home/yoursunny/xobug/node_modules/xo/config/plugins.js': Cannot find module '@babel/core' #519

Closed
yoursunny opened this issue Feb 17, 2021 · 5 comments

Comments

@yoursunny
Copy link

Snippet to Reproduce

package.json

{
  "private": true,
  "dependencies": {
    "xo": "^0.37.1"
  }
}

1.js

console.log("OK");

Actual Behavior

$ ./node_modules/.bin/xo 1.js
Error: Failed to load plugin 'unicorn' declared in 'BaseConfig » /home/yoursunny/xobug/node_modules/xo/config/plugins.js': Cannot find module '@babel/core'
Require stack:
- /home/yoursunny/xobug/node_modules/@babel/eslint-parser/lib/index.js
- /home/yoursunny/xobug/node_modules/eslint-template-visitor/lib/index.js
- /home/yoursunny/xobug/node_modules/eslint-template-visitor/index.js
- /home/yoursunny/xobug/node_modules/eslint-plugin-unicorn/rules/import-style.js
- /home/yoursunny/xobug/node_modules/import-modules/index.js
- /home/yoursunny/xobug/node_modules/eslint-plugin-unicorn/index.js
- /home/yoursunny/xobug/node_modules/@eslint/eslintrc/lib/config-array-factory.js
- /home/yoursunny/xobug/node_modules/@eslint/eslintrc/lib/index.js
- /home/yoursunny/xobug/node_modules/eslint/lib/cli-engine/cli-engine.js
- /home/yoursunny/xobug/node_modules/eslint/lib/cli-engine/index.js
- /home/yoursunny/xobug/node_modules/eslint/lib/api.js
- /home/yoursunny/xobug/node_modules/xo/index.js
- /home/yoursunny/xobug/node_modules/xo/cli-main.js
- /home/yoursunny/xobug/node_modules/xo/cli.js
Referenced from: /home/yoursunny/xobug/node_modules/xo/config/plugins.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/home/yoursunny/xobug/node_modules/@babel/eslint-parser/lib/index.js:11:13)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)

Expected Behavior

No error.

@sindresorhus
Copy link
Member

What Node.js and npm version?

@yoursunny
Copy link
Author

$ node --version
v14.15.4

$ npm --version
6.14.10

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.5 LTS
Release:	18.04
Codename:	bionic

@sindresorhus
Copy link
Member

Try upgrading to the latest npm version (v7) and then run: npm cache clean -fg && rm -rf ./node_modules && npm i

@yoursunny
Copy link
Author

This issue does not occur with NPM 7.5.4.
Thus, I'd recommend adding an engine.npm = ^7.5.0 restriction in package.json.

This issue still occurs with PNPM 5.17.2, even with NPM 7 installed.
It used to work with pnpm install --shamefully-hoist but suddenly stopped working this week.
Any idea why this may happen?

@fregante
Copy link
Member

fregante commented Aug 6, 2022

Closing in favor of #546

@fregante fregante marked this as a duplicate of #546 Aug 6, 2022
@fregante fregante closed this as not planned Won't fix, can't repro, duplicate, stale Aug 6, 2022
pepoirot added a commit to pepoirot/hls-parser that referenced this issue Dec 4, 2022
Additional dependencies were added to resolve the following errors:
- xojs/xo#631
- xojs/xo#519
kuu pushed a commit to kuu/hls-parser that referenced this issue Dec 4, 2022
Additional dependencies were added to resolve the following errors:
- xojs/xo#631
- xojs/xo#519
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

No branches or pull requests

3 participants