prettier-vscode icon indicating copy to clipboard operation
prettier-vscode copied to clipboard

Failed to load 'react-hooks'

Open shaunjanssens opened this issue 7 years ago • 38 comments

Failed to format React files

I'm using VSCode - insiders and Remote - SSH to develop on a remote machine. When using create-react-app, Prettiers fails to format the files and gives an error.

Steps To Reproduce:

  1. Create React app with npx create-react-app app
  2. Configure ESLint and Prettier extensions in VSCode
  3. Save file

Expected result

Formatted file.

Actual result

Error by Prettier:

8/16/2019, 9:45:43 AM:
----------------------
Failed to load plugin 'react-hooks' declared in 'CLIOptions'/home/shaunjanssens/projects/gotoo/webapp/src/App.js:: Cannot find module 'eslint-plugin-react-hooks'
Require stack:
- /home/shaunjanssens/__placeholder__.js

Additional information

VS Code Version: 1.38.0-insider

Prettier & Prettier Plugin Version: 1.18.2 (installed on server) / 1.9.0

OS and version: Mac OS and Ubuntu 18.04 (remote development)

React-scripts: 3.1.1

settings.json

{
  "eslint.validate": [
    {
      "language": "vue",
      "autoFix": true
    },
    {
      "language": "html",
      "autoFix": true
    },
    {
      "language": "javascript",
      "autoFix": true
    },
    {
      "language": "react",
      "autoFix": true
    }
  ],
  "eslint.autoFixOnSave": true,
  "editor.formatOnPaste": true,
  "editor.formatOnSave": true,
  "editor.formatOnType": false,
  "prettier.eslintIntegration": true,
  "prettier.singleQuote": true,
  "prettier.semi": false
}

I already tried to install eslint-plugin-react-hooks both as a dev dependency and global on server.

shaunjanssens avatar Aug 16 '19 08:08 shaunjanssens

same problem

  • windows 10
  • create-react-app v3.1.1
  • vscode version 1.37.1

danikkks avatar Aug 17 '19 15:08 danikkks

same here

  • macOS Mojave 10.14.5
  • vscode 1.36.1
  • prettier-vscode 1.9.0
  • CRA 3.1.1

I guess the problem lies on the eslint version 6.x, it's incompatible with the current version of prettier-vscode.

xinkule avatar Aug 19 '19 16:08 xinkule

same problem here

danihazler avatar Aug 20 '19 12:08 danihazler

Also experiencing this issue

  • windows 10
  • create-react-app 3.0.1
  • vscode 1.37.1
  • prettier 1.9.0

jaegz avatar Aug 20 '19 12:08 jaegz

Same problem here

rrlevy avatar Aug 20 '19 22:08 rrlevy

also experiencing this problem:

  • macOS Mojave 10.14.6
  • vscode 1.37.1
  • prettier 1.9.0

gregkonush avatar Aug 21 '19 01:08 gregkonush

Same problem here

  • windows 10 64bit
  • vscode 1.37.1
  • prettier1.9.0
  • CRA 3.1.1

cemujax avatar Aug 21 '19 08:08 cemujax

Same problem here

windows 10 64bit vscode 1.37.1 CRA 3.1.0

xrf-9527 avatar Aug 21 '19 08:08 xrf-9527

Must be a vscode issue

agusterodin avatar Aug 21 '19 15:08 agusterodin

Same as @cemujax here

  • windows 10 64bit
  • vscode 1.37.1
  • prettier1.9.0
  • CRA 3.1.1

eclecticjohny avatar Aug 21 '19 18:08 eclecticjohny

same problem

windows 10 create-react-app v3.1.1 vscode version 1.37.1

lsw8168 avatar Aug 21 '19 23:08 lsw8168

prettier 1.9.0 vscode 1.37.1 eslint-plugin-vue and eslint last version

I get Similar problem i got the error of 'Failed to load plugin 'vue' declared in........cant get module eslint-plugin-vue' but i already install it both as a dev dependency and global dependency.

WeiShengv99 avatar Aug 22 '19 04:08 WeiShengv99

https://github.com/facebook/react/issues/16531#issuecomment-523620795

rm -rf node_modules && npm i and then restart vscode fixed it for me.

tylergraf avatar Aug 22 '19 04:08 tylergraf

@tylergraf I do like you talk but I can't fix this issue

yogathanh99 avatar Aug 22 '19 13:08 yogathanh99

Yep facing same issue

deadcoder0904 avatar Aug 22 '19 13:08 deadcoder0904

same

tim-sheung avatar Aug 22 '19 14:08 tim-sheung

I was able to correct this issue by deleting eslint-config-react-app from node_modules and reinstalling the newest version via npm i --save-dev eslint-config-react-app.

OS: Windows 10 CRA: v3.1.1 VSCode: v1.37.1

Jonny15t avatar Aug 22 '19 15:08 Jonny15t

I resolve this problem use "prettier.eslintIntegration": false in my VSCode config

izayl avatar Aug 23 '19 07:08 izayl

Thanks, @izayl. I fixed this issue like you

yogathanh99 avatar Aug 23 '19 09:08 yogathanh99

RIP productivity and sanity at work this week. Hope someone finds a proper fix

agusterodin avatar Aug 24 '19 06:08 agusterodin