升级所有节点模块后无法加载插件“更漂亮”

时间:2019-08-12 12:55:27

标签: vue.js eslint prettier

我有一个VUE项目,我刚刚用“ ncu -u”升级了所有模型,现在当我运行“ npm run serve”时,出现此错误:

Module build failed (from ./node_modules/eslint-loader/index.js):
Error: Failed to load plugin 'prettier' declared in '.eslintrc.js': Cannot find module 'eslint-plugin-prettier'
Require stack:
- /Users/neigaard/vue/real-world-vue/__placeholder__.js
Referenced from: /Users/neigaard/vue/real-world-vue/.eslintrc.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:713:15)
    at Function.resolve (internal/modules/cjs/helpers.js:74:19)
    at Object.resolve (/Users/neigaard/vue/real-world-vue/node_modules/eslint/lib/shared/relative-module-resolver.js:44:50)
    at ConfigArrayFactory._loadPlugin (/Users/neigaard/vue/real-world-vue/node_modules/eslint/lib/cli-engine/config-array-factory.js:841:39)
    at ConfigArrayFactory._loadExtendedPluginConfig (/Users/neigaard/vue/real-world-vue/node_modules/eslint/lib/cli-engine/config-array-factory.js:661:29)
    at ConfigArrayFactory._loadExtends (/Users/neigaard/vue/real-world-vue/node_modules/eslint/lib/cli-engine/config-array-factory.js:607:29)
    at ConfigArrayFactory._normalizeObjectConfigDataBody (/Users/neigaard/vue/real-world-vue/node_modules/eslint/lib/cli-engine/config-array-factory.js:545:25)
    at _normalizeObjectConfigDataBody.next ()
    at ConfigArrayFactory._normalizeObjectConfigData (/Users/neigaard/vue/real-world-vue/node_modules/eslint/lib/cli-engine/config-array-factory.js:491:20)
    at _normalizeObjectConfigData.next ()
    at createConfigArray (/Users/neigaard/vue/real-world-vue/node_modules/eslint/lib/cli-engine/config-array-factory.js:307:25)
    at ConfigArrayFactory.loadInDirectory (/Users/neigaard/vue/real-world-vue/node_modules/eslint/lib/cli-engine/config-array-factory.js:400:16)
    at CascadingConfigArrayFactory._loadConfigInAncestors (/Users/neigaard/vue/real-world-vue/node_modules/eslint/lib/cli-engine/cascading-config-array-factory.js:304:46)
    at CascadingConfigArrayFactory._loadConfigInAncestors (/Users/neigaard/vue/real-world-vue/node_modules/eslint/lib/cli-engine/cascading-config-array-factory.js:323:20)
    at CascadingConfigArrayFactory.getConfigArrayForFile (/Users/neigaard/vue/real-world-vue/node_modules/eslint/lib/cli-engine/cascading-config-array-factory.js:249:18)
    at CLIEngine.executeOnText (/Users/neigaard/vue/real-world-vue/node_modules/eslint/lib/cli-engine/cli-engine.js:860:47)

我的.eslintrc.js看起来像这样:

module.exports = {
  root: true,
  env: {
    node: true
  },
  extends: [
    'plugin:vue/essential',
    "plugin:prettier/recommended",
    '@vue/prettier'
  ],
  rules: {
    'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
    'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
  },
  parserOptions: {
    parser: 'babel-eslint'
  }
}

我是VUE和Node的新手,所以任何提示都值得赞赏。

谢谢
索伦

0 个答案:

没有答案