Module build failed (from ./node_modules/eslint-loader/index.js)

解决办法1:

执行以下命令:

npm init -y
 
npm install eslint --save-dev

进入./node_modules/.bin/文件夹,执行以下命令:

cd ./node_modules/.bin/
 
eslint --init

在对话框中除了选择Vue.js,其它选项默认即可,如下所示:

? How would you like to use ESLint? To check syntax and find problems
? What type of modules does your project use? JavaScript modules (import/export)
? Which framework does your project use? Vue.js
? Where does your code run? (Press <space> to select, <a> to toggle all, <i> to invert selection)Browser
? What format do you want your config file to be in? JavaScript
Checking peerDependencies of eslint-config-eslint:recommended,plugin:vue/essential@latest
Local ESLint installation not found.
The config that you've selected requires the following dependencies:
 
eslint-plugin-vue@latest eslint-config-eslint:recommended,plugin:vue/essential@latest error@[object Object] eslint@latest
? Would you like to install them now with npm? Yes
Installing eslint-plugin-vue@latest, eslint-config-eslint:recommended,plugin:vue/essential@latest, error@[object Object], eslint@latest
npm ERR! code EINVALIDTAGNAME
npm ERR! Invalid tag name "[object Object]": Tags may not have any characters that encodeURIComponent encodes.
 
npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\lenovo\AppData\Roaming\npm-cache\_logs\2019-06-11T08_56_58_344Z-debug.log
Successfully created .eslintrc.js file in D:\study\vue\vue2\vuesaxvuejs-210\vuesaxvuejs-210\node_modules\.bin

把./node_modules/.bin/文件夹下面生成的.eslintrc.js文件,拷贝到项目根目录。
解决办法2:

首先,安装 ESLint。

npm i -g eslint

然后,安装 Airbnb 语法规则,以及 import、a11y、react 插件。

npm i -g eslint-config-airbnb
$ npm i -g eslint-plugin-import eslint-plugin-jsx-a11y eslint-plugin-react

最后,在项目的根目录下新建一个.eslintrc文件,配置 ESLint。
{
"extends": "eslint-config-airbnb"
}
转自:https://blog.csdn.net/daqiang012/article/details/91419230

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • 本文是对vue项目中自带文件eslintrc.js的内容解析, 介绍了各个eslint配置项的作用,以及为什么这样...
    Marting424阅读 5,692评论 0 0
  • 一、JSLint JSHint ESLint 参考前端工具考 - ESLint 篇JS Linter 进化史 C ...
    合肥黑阅读 77,231评论 0 47
  • 小沈是一个刚刚开始工作的前端实习生,第一次进行团队开发,难免有些紧张。在导师的安排下,拿到了项目的 git 权限,...
    Nanayai阅读 2,335评论 4 10
  • EsLint入门学习整理 这两天因为公司要求,就对ESLint进行了初步的了解,网上的内容基本上都差不多,但是内容...
    点柈阅读 26,217评论 3 42
  • 我最近在看豆瓣评分9.4分的《机智牢房生活》,9.4分有多高呢?要知道,作为人型吸粉机的我们孔刘大叔,他主演的《孤...
    阿不快跑阅读 1,064评论 0 1

友情链接更多精彩内容