question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failed to load plugin 'react-native' declared in 'CLIOptions': Cannot find module 'eslint-plugin-react-native'

See original GitHub issue

Summary

Unable to format files in my react native project. Whenever I try to format document I am getting an error message but I’m unable to reproduce it for any other project.

Github Repository to Reproduce Issue

Unable to reproduce the issue. Only happens in a private project

Steps To Reproduce:

  1. Open the required file
  2. Click cmd+shift+P and select format document

Expected result

The document should be formatted

Actual result

Couldn’t format the document

Additional information

VS Code Version: 1.41.1

Prettier Extension Version: 3.18.0

OS and version: Mac OS 10.15

Prettier Log Output

["INFO" - 12:51:56 PM] Loaded module 'prettier@1.19.1' from '/Users/apple/Documents/react-native/myProject/node_modules/prettier/index.js'
["INFO" - 12:51:58 PM] Formatting /Users/apple/Documents/react-native/myProject/Screens/BookingsHomeScreen/Components/BookingAccordion/Components/PassSection.js
["INFO" - 12:51:58 PM] Loaded module 'prettier@1.19.1' from '/Users/apple/Documents/react-native/myProject/node_modules/prettier/index.js'
["INFO" - 12:51:58 PM] Using ignore file (if present) at /Users/apple/Documents/react-native/myProject/.prettierignore
["INFO" - 12:51:58 PM] File Info:
{
  "ignored": false,
  "inferredParser": "babel"
}
["INFO" - 12:51:58 PM] Detected local configuration (i.e. .prettierrc or .editorconfig), VS Code configuration will not be used
["INFO" - 12:51:58 PM] Prettier Options:
{
  "filepath": "/Users/apple/Documents/react-native/myProject/Screens/BookingsHomeScreen/Components/BookingAccordion/Components/PassSection.js",
  "parser": "babel",
  "useTabs": false,
  "tabWidth": 2,
  "endOfLine": "lf"
}
["INFO" - 12:51:58 PM] Loaded module 'prettier-eslint@unknown' from '/Users/apple/Documents/react-native/myProject/node_modules/prettier-eslint/dist/index.js'
["INFO" - 12:51:58 PM] Formatting using 'prettier-eslint'
["ERROR" - 12:51:58 PM] Error formatting document.
Failed to load plugin 'react-native' declared in 'CLIOptions': Cannot find module 'eslint-plugin-react-native'
Require stack:
- /__placeholder__.js
Error: Failed to load plugin 'react-native' declared in 'CLIOptions': Cannot find module 'eslint-plugin-react-native'
Require stack:
- /__placeholder__.js
	at Function.Module._resolveFilename (internal/modules/cjs/loader.js:627:15)
	at Function.resolve (internal/modules/cjs/helpers.js:21:19)
	at Object.resolve (/Users/apple/Documents/react-native/myProject/node_modules/eslint/lib/shared/relative-module-resolver.js:44:50)
	at ConfigArrayFactory._loadPlugin (/Users/apple/Documents/react-native/myProject/node_modules/eslint/lib/cli-engine/config-array-factory.js:845:39)
	at /Users/apple/Documents/react-native/myProject/node_modules/eslint/lib/cli-engine/config-array-factory.js:734:33
	at Array.reduce (<anonymous>)
	at ConfigArrayFactory._loadPlugins (/Users/apple/Documents/react-native/myProject/node_modules/eslint/lib/cli-engine/config-array-factory.js:730:22)
	at ConfigArrayFactory._normalizeObjectConfigDataBody (/Users/apple/Documents/react-native/myProject/node_modules/eslint/lib/cli-engine/config-array-factory.js:554:32)
	at _normalizeObjectConfigDataBody.next (<anonymous>)
	at ConfigArrayFactory._normalizeObjectConfigData (/Users/apple/Documents/react-native/myProject/node_modules/eslint/lib/cli-engine/config-array-factory.js:491:20)
	at _normalizeObjectConfigData.next (<anonymous>)
	at createConfigArray (/Users/apple/Documents/react-native/myProject/node_modules/eslint/lib/cli-engine/config-array-factory.js:307:25)
	at ConfigArrayFactory.create (/Users/apple/Documents/react-native/myProject/node_modules/eslint/lib/cli-engine/config-array-factory.js:362:16)
	at createCLIConfigArray (/Users/apple/Documents/react-native/myProject/node_modules/eslint/lib/cli-engine/cascading-config-array-factory.js:133:47)
	at new CascadingConfigArrayFactory (/Users/apple/Documents/react-native/myProject/node_modules/eslint/lib/cli-engine/cascading-config-array-factory.js:200:29)
	at new CLIEngine (/Users/apple/Documents/react-native/myProject/node_modules/eslint/lib/cli-engine/cli-engine.js:549:36)
	at getESLintCLIEngine (/Users/apple/Documents/react-native/myProject/node_modules/prettier-eslint/dist/utils.js:401:12)
	at eslintFix (/Users/apple/Documents/react-native/myProject/node_modules/prettier-eslint/dist/index.js:151:53)
	at format (/Users/apple/Documents/react-native/myProject/node_modules/prettier-eslint/dist/index.js:119:10)
	at /Users/apple/.vscode/extensions/esbenp.prettier-vscode-3.18.0/dist/extension.js:1:351860
	at t.default.safeExecution (/Users/apple/.vscode/extensions/esbenp.prettier-vscode-3.18.0/dist/extension.js:1:352534)
	at t.default.<anonymous> (/Users/apple/.vscode/extensions/esbenp.prettier-vscode-3.18.0/dist/extension.js:1:351834)
	at Generator.next (<anonymous>)
	at s (/Users/apple/.vscode/extensions/esbenp.prettier-vscode-3.18.0/dist/extension.js:1:346304)
["INFO" - 12:51:58 PM] Formatting completed in 59.06898ms.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ntottencommented, Jan 29, 2020

Could you provide a sample repo or full reproduction steps so I can recreate the issue?

0reactions
github-actions[bot]commented, May 1, 2020

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dealing with "Failed to load plugin 'react' declared in '.eslintrc'
The problem I was having is that I used npm --lonly=prod which doesn't install any of the eslint dependencies (duh). Hopefully this helps...
Read more >
eslint-plugin-react - npm
Start using eslint-plugin-react in your project by running `npm i ... display-name, Disallow missing displayName in a React component ...
Read more >
[eslint] failed to load plugin 'prettier' declared in '.eslintrc.json'
Indeed, I cannot find the module 'eslint-plugin-babel' in node_modules, however I have installed it. I have tried to solve this issue / search...
Read more >
@react-native-community/eslint-plugin - npm package | Snyk
Ensure you're using the healthiest npm packages. Snyk scans all the packages in your projects for vulnerabilities and provides automated fix advice. Get...
Read more >
eslint, prettier, and vs code - when they stop cooperating
Footnotes. Failed to load plugin 'prettier' declared in 'CLIOptions': Cannot find module 'eslint-plugin-prettier' · ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found