English 中文(简体)
找不到更漂亮模块
原标题:Cannot find module prettier

我更新了所有软件包, 但仍在运行 < strong > npm 运行服务 后收到此错误 :

Module build failed (from ./node_modules/eslint-loader/index.js): Error: Cannot find module prettier Occurred while linting /home

我的包裹。 json(json)

{
  "name": "app",
  "version": "0.1.0",
  "private": false,
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint"
  },
  "dependencies": {
    "core-js": "^3.2.1",
    "firebase": "^7.0.0",
    "material-icons": "^0.3.1",
    "register-service-worker": "^1.6.2",
    "vue": "^2.6.10",
    "vue-flickity": "^1.2.1",
    "vue-router": "^3.1.3",
    "vuetify": "^2.0.19",
    "vuex": "^3.1.1"
  },
  "devDependencies": {
    "@mdi/font": "^4.4.95",
    "@vue/cli-plugin-babel": "^3.11.0",
    "@vue/cli-plugin-eslint": "^3.11.0",
    "@vue/cli-plugin-pwa": "^3.11.0",
    "@vue/cli-service": "^3.11.0",
    "@vue/eslint-config-prettier": "^5.0.0",
    "babel-eslint": "^10.0.3",
    "eslint": "^6.4.0",
    "eslint-plugin-vue": "^5.2.3",
    "material-design-icons-iconfont": "^5.0.1",
    "stylus": "^0.54.7",
    "stylus-loader": "^3.0.2",
    "uglifyjs-webpack-plugin": "^2.2.0",
    "vue-cli-plugin-vuetify": "^0.6.3",
    "vue-template-compiler": "^2.6.10",
    "vuetify-loader": "^1.3.0",
    "webpack": "^4.41.0",
    "webpack-cli": "^3.3.9"
  },
  "eslintConfig": {
    "root": true,
    "env": {
      "node": true
    },
    "extends": [
      "plugin:vue/essential",
      "@vue/prettier"
    ],
    "rules": {
      "no-console": "off"
    },
    "parserOptions": {
      "parser": "babel-eslint"
    }
  },
  "postcss": {
    "plugins": {
      "autoprefixer": {}
    }
  },
  "browserslist": [
    "> 1%",
    "last 2 versions"
  ]
}

**"@vue/eslint-config-prettier": "^5.0.0",** is listed in the dependencies. How to fix this issue? (I m using VSCODE on Ubuntu)

我多次尝试删除 < 坚固 > package- lock.json 和 < 坚固 > node_ modules 并随后安装 npm。 没有任何东西能修正它 - 甚至更新全球所有软件包 。

最佳回答

Prettier is a peer dependency of @vue/eslint-config-prettier so you need to add it to your own dependencies:

npm install --save-dev prettier
问题回答

如果您再使用线条 3 和 yarn add -- dev beferent 无法解决您的问题, 请尝试 :

  1. cmd + shift + p
  2. in the dropdown, search for preferences: open user settings (json)
  3. add "prettier.prettierPath": ".yarn/sdks/prettier/index.js" to your json file.

这将指示您的编辑器在您添加的路径中查找模块 。

NOTE :如果在 .yarn 中不存在 sdks 目录,请确保首次运行以下命令以生成相关目录。

The latest version and workflow is for Yarn 4.0.0-rc.48
yarn dlx @yarnpkg/sdks base

您可以在“https://yarnpkg.com/getting-started/editor-sdks#scode”中阅读更多有关编辑 sdks 的更多信息。 rel=“noreferr”>doc

" 强 " 与国家预防机制 " /强 "

npm install --save-dev prettier

" 强 " 与 " 亚 " / " 强 "

yarn add --dev prettier

我想分享我在同一案件中的经验...

如果您在运行您的工程时使用某种工具,如 Docker / /Warden /etc >,且您只在容器外壳内使用所有 npm //code>命令,那么 Pretier 模块将无法为您 IDE /code > 如 Visual演播室代码 / Atom /etc > 的 模块所识别。

要解决这个问题, 请在本地驱动器的容器外安装 < code> Prettier 模块和其他模块( command < code> npm 安装 / < code>/ yarn 安装 安装 < / code > / code > ) 。 这样的方法可以解决 Prettier 模块问题, 您也可以使用 IDE 或系统外壳的格式 。

请原谅我的无知, 但为什么我的全球更美的装置 还没有被VS代码所看到呢?





相关问题
How to make Sequelize use singular table names

I have an model called User but Sequelize looks for the table USERS whenever I am trying to save in the DB. Does anyone know how to set Sequelize to use singular table names? Thanks.

What is Node.js? [closed]

I don t fully get what Node.js is all about. Maybe it s because I am mainly a web based business application developer. What is it and what is the use of it? My understanding so far is that: The ...

Clientside going serverside with node.js

I`ve been looking for a serverside language for some time, and python got my attention somewhat. But as I already know and love javascript, I now want learn to code on the server with js and node.js. ...

Can I use jQuery with Node.js?

Is it possible to use jQuery selectors/DOM manipulation on the server-side using Node.js?

How do I escape a string for a shell command in node?

In nodejs, the only way to execute external commands is via sys.exec(cmd). I d like to call an external command and give it data via stdin. In nodejs there does yet not appear to be a way to open a ...