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  to select,  to toggle all,  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

你可能感兴趣的:(Module build failed (from ./node_modules/eslint-loader/index.js))