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

Extension not working: Cannot find module 'acorn'

Open alexeychikk opened this issue 7 years ago • 9 comments

Extension is not working currently and outputs the following error Cannot find module 'acorn'. Reinstalling didn't help. It helped when I manually installed acorn package in the project's folder even though my project doesn't depend on it.

alexeychikk avatar Jun 23 '19 09:06 alexeychikk

I'm also facing similar issue. Any plugin in plugins errors out Cannot find module <module name> .eslintrc ->

{
  "parser": "babel-eslint",
  "parserOptions": {
      "sourceType": "module"
  },
  "env": {
    "browser": true,
    "node": true,
    "jest": true,
    "es6": true
  },
  "plugins": [
    "prettier",
    "react",
    "jest"
  ],
  "extends": [
    "eslint:recommended",
    "plugin:react/recommended"
  ],
  "settings": {
    "react": {
      "createClass": "createReactClass",
      "pragma": "React",
      "version": "detect"
    }
  },
  "rules": {
    "react/destructuring-assignment": [2, "always", { "ignoreClassFields": true }],
    "react/no-array-index-key": 2,
    "react/no-unused-state": 2,
    "react/no-unused-prop-types": 2,
    "prettier/prettier": "error",
    "no-nested-ternary": 2,
    "semi": [2, "always"],
    "prefer-destructuring": ["error", {"object": true, "array": true}],
    "prefer-const": ["error", {
      "destructuring": "any"
    }],
    "indent": ["error", 2, { "SwitchCase": 1 }],
    "max-len": ["error", { "code": 120 }]
  }
}

package.json ->

"eslint": "^6.0.0",
    "eslint-config-prettier": "^5.0.0",
    "eslint-plugin-import": "^2.17.3",
    "eslint-plugin-jest": "^22.7.1",
    "eslint-plugin-jsx-a11y": "^6.2.1",
    "eslint-plugin-prettier": "^3.1.0",
    "eslint-plugin-react": "^7.13.0",
    "prettier": "^1.18.2",

himanshupnt avatar Jun 23 '19 20:06 himanshupnt

Same issue here. VS code throws me an error each time I try to format: image This is only within vscode itself, the cli tool works perfectly using "prettier --write /somefile.js"

Some additional info: eslint debug shows no errors - eslint is working as intended Any plugin/extends throw the same error not only eslint-plugin-prettier Tried installing/uninstalling globally, same issue eveytime.

alaadotsol avatar Jun 25 '19 05:06 alaadotsol

i donwgraded eslint to ^4.0.0 until a fix

cannap avatar Jun 27 '19 09:06 cannap

I downgraded eslint to ^4.0.0

Works for me as well:

  • ESLint: v4.0.0
  • Node: v10.14.2
  • VS Code: 1.35.1

EthanNYT avatar Jun 28 '19 18:06 EthanNYT

Try to remove everything from settings.json. It should fix the problem.

ghost avatar Jul 24 '19 14:07 ghost

i dont have any prettier related stuff in settings.json

this is my workspace settings.json file

{ "search.exclude": { "/.nuxt": true }, "files.watcherExclude": { "/.nuxt": true }, "files.exclude": { "**/.nuxt": true }, "vue-i18n-ally.localesPaths": "lang" }

cannap avatar Jul 24 '19 16:07 cannap

What I did was to remove any reference to esLint on settings.json I removed:

{
  "prettier.eslintIntegration": true,
  "eslint.enable": true,
}

and it worked fine

samarti avatar Jul 26 '19 15:07 samarti

Duplicate of #870

ntotten avatar Aug 12 '19 15:08 ntotten

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.

github-actions[bot] avatar Apr 12 '20 22:04 github-actions[bot]