大家好,又见面了,我是你们的朋友全栈君。
错误信息:
D:\study\vue\vuesaxvuejs-210\vuesaxvuejs-210>npm run serve
> vuesax-vuejs-dashboard-admin-template@2.1.0 serve D:\study\vue\vuesaxvuejs-210\vuesaxvuejs-210
> vue-cli-service serve
INFO Starting development server…
98% after emitting CopyPlugin
ERROR Failed to compile with 1 errors 11:34:03
Module build failed (from ./node_modules/eslint-loader/index.js):
Error: No ESLint configuration found.
at Config.getLocalConfigHierarchy (D:\study\vue\vuesaxvuejs-210\vuesaxvuejs-210\node_modules\eslint\lib\config.js:255:39)
at Config.getConfigHierarchy (D:\study\vue\vuesaxvuejs-210\vuesaxvuejs-210\node_modules\eslint\lib\config.js:179:43)
at Config.getConfigVector (D:\study\vue\vuesaxvuejs-210\vuesaxvuejs-210\node_modules\eslint\lib\config.js:286:21)
at Config.getConfig (D:\study\vue\vuesaxvuejs-210\vuesaxvuejs-210\node_modules\eslint\lib\config.js:329:29)
at processText (D:\study\vue\vuesaxvuejs-210\vuesaxvuejs-210\node_modules\eslint\lib\cli-engine.js:163:33)
at CLIEngine.executeOnText (D:\study\vue\vuesaxvuejs-210\vuesaxvuejs-210\node_modules\eslint\lib\cli-engine.js:620:17)
at lint (D:\study\vue\vuesaxvuejs-210\vuesaxvuejs-210\node_modules\eslint-loader\index.js:263:17)
at transform (D:\study\vue\vuesaxvuejs-210\vuesaxvuejs-210\node_modules\eslint-loader\index.js:237:18)
at D:\study\vue\vuesaxvuejs-210\vuesaxvuejs-210\node_modules\loader-fs-cache\index.js:127:18
at ReadFileContext.callback (D:\study\vue\vuesaxvuejs-210\vuesaxvuejs-210\node_modules\loader-fs-cache\index.js:31:14)
at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:238:13)
You may use special comments to disable some warnings.
Use // eslint-disable-next-line to ignore the next line.
Use /* eslint-disable */ to ignore all warnings in a file.
解决办法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\_logs19-06-11T08_56_58_344Z-debug.log
Successfully created .eslintrc.js file in D:\study\vue\vue2\vuesaxvuejs-210\vuesaxvuejs-210\node_modules\.bin
ESLint was installed locally. We recommend using this local copy instead of your globally-installed copy.
把./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"
}
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/150478.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...