javascript - Nuxt.js:模块错误(来自./node_modules/eslint-loader/index.js):

标签 javascript css-loader nuxt.js

我安装了 Nuxt 入门模板 recommended方式:

npx create-nuxt-app fffff

一旦进入 fffff 我安装了 css-loder (npm install --save-dev css-loader) 然后我启动了服务器:npm run dev

我收到此错误消息:

> fffff@1.0.0 dev /home/begueradj/fffff
> nuxt



 INFO  Building project

✔ success Builder initialized
✔ success Nuxt files generated


 ERROR  Failed to compile with 1 errors                                                                                                                         22:09:09

 error  in ./layouts/default.vue

Module Error (from ./node_modules/eslint-loader/index.js):

/home/begueradj/fffff/layouts/default.vue
   89:1  error  Delete `··`                           prettier/prettier
   90:3  error  Delete `··`                           prettier/prettier
   91:1  error  Replace `······` with `····`          prettier/prettier
   92:1  error  Delete `··`                           prettier/prettier
   93:1  error  Replace `········` with `······`      prettier/prettier
   94:1  error  Delete `··`                           prettier/prettier
   95:1  error  Replace `········` with `······`      prettier/prettier
   96:1  error  Delete `··`                           prettier/prettier
   97:1  error  Replace `··········` with `········`  prettier/prettier
   98:7  error  Delete `··`                           prettier/prettier
   99:1  error  Delete `··`                           prettier/prettier
  100:7  error  Delete `··`                           prettier/prettier
  101:1  error  Delete `··`                           prettier/prettier
  102:7  error  Delete `··`                           prettier/prettier
  103:5  error  Delete `··`                           prettier/prettier
  104:1  error  Replace `····` with `··`              prettier/prettier
  105:1  error  Delete `··`                           prettier/prettier

✖ 17 problems (17 errors, 0 warnings)
  17 errors and 0 warnings potentially fixable with the `--fix` option.


 @ ./.nuxt/App.js 4:0-47 6:14-23
 @ ./.nuxt/index.js
 @ ./.nuxt/client.js
 @ multi webpack-hot-middleware/client?name=client&reload=true&timeout=30000&path=/__webpack_hmr ./.nuxt/client.js



 READY  Listening on http://localhost:3000

这是什么原因造成的?如何解决?

最佳答案

create-nuxt-app 生成的默认源代码不遵守 ESlint + Prettier 规则。

尝试手动修复每条规则:

例如。 91:1 error Replace '······' with '····' => 将文件第 91 行开头的 6 个空格替换为 4 个空格 layouts/default.vue.

使用以下命令自动修复所有规则:

npx prettier --write "**/*.{vue,js}"

关于javascript - Nuxt.js:模块错误(来自./node_modules/eslint-loader/index.js):,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52571675/

相关文章:

javascript - 迭代动态数组中的特定字段(例如第 5 个、第 10 个、第 15 个……)

javascript - Uncaught Error : [$injector:modulerr] Failed to instantiate module myApp due to: Error: [$injector:unpr] Unknown provider: $routeProvider

webpack - extract-text-webpack-plugin 不创建 CSS 文件

nuxt.js - 如何在Buefy中使用nuxt-link标签?

javascript - 通过 Javascript 获取月中的周数

javascript - setinterval 失去输入字段的焦点

javascript - Webpack 未构建,因为 CssSyntaxError

css - 模块构建失败(来自 ./node_modules/css-loader/dist/cjs.js): CssSyntaxError

vue.js - Nuxt 的 Vuex 中的项目是否正在被抓取?

javascript - 带有 Auth0 提供程序的 Nuxt Auth 模块导致重定向循环