简体   繁体   English

ESLint:5.0.1 错误

[英]ESLint: 5.0.1 Error

I'm creating a project following this tutorial: Full Stack Web App using Vue.js & Express.js: Part 1 - Intro我正在按照本教程创建一个项目: 使用 Vue.js 和 Express.js 的全栈 Web 应用程序:第 1 部分 - 介绍

I ran the next command: "npm start" which was configured in my package.json like this:我运行了下一个命令:“npm start”,它在我的 package.json 中配置如下:

"scripts": {
        "start": "./node_modules/nodemon/bin/nodemon.js src/app.js --exec 'npm run lint && node'",
        "lint": "./node_modules/.bin/eslint **/*.js"
      },

But ESLint throws the next error:但是 ESLint 抛出了下一个错误:

Oops! Something went wrong! :(

ESLint: 5.0.1. No files matching the pattern "node_modules/ipaddr.js" were found. Please check for typing mistakes in the pattern.

npm ERR! code ELIFECYCLE npm ERR! errno 2 npm ERR! server@1.0.0 lint: `eslint **/*.js` npm ERR! Exit status 2 npm ERR!  npm ERR! Failed at the server@1.0.0 lint script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR!     /home/ironman/.npm/_logs/2018-06-26T13_45_13_295Z-debug.log [nodemon] process failed, unhandled exit code (2) [nodemon] Error
    at Bus.utils.bus.on (/home/ironman/Documentos/Sandbox/Vuexpress/server/node_modules/nodemon/lib/nodemon.js:148:25)
    at Bus.emit (events.js:187:15)
    at ChildProcess.<anonymous> (/home/ironman/Documentos/Sandbox/Vuexpress/server/node_modules/nodemon/lib/monitor/run.js:164:11)
    at ChildProcess.emit (events.js:182:13)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:237:12)

I know there is another thread asked yesterday but i can't comment on it unless i have 50 reputation.我知道昨天有人问了另一个话题,但除非我有 50 名声望,否则我无法对此发表评论。 Also, joknawe points out that maybe eslint is trying to lint my node_modules directory but i don't know how to ignore it.另外, joknawe指出,也许 eslint 正在尝试 lint 我的 node_modules 目录,但我不知道如何忽略它。

Is there any way to solve this issue ?有没有办法解决这个问题?

Below worked:以下工作:

// Pass on both Windows & Ubuntu.  
// Note the slash & double quotes

// File: package.json:  

"scripts": {
  "lint": "eslint \"./**/*.js\"",
}

Below didn't work, on one of the OS:以下在其中一个操作系统上不起作用:

// Windows - Fail -  "Oops! Something went wrong! :("  
// Note the single quotes

"lint": "eslint './**/*.js'",


// Ubuntu - Fail
// Note no quotes

"lint": "eslint ./**/*.js",

Hope that helps.希望有帮助。

I've solved the exact same issue by changing我已经通过更改解决了完全相同的问题

"lint": "./node_modules/.bin/eslint **/*.js" "lint": "./node_modules/.bin/eslint **/*.js"

to

"lint": "./node_modules/.bin/eslint src/*.js" "lint": "./node_modules/.bin/eslint src/*.js"

Hope this help.希望这有帮助。

I had the same issue.我遇到过同样的问题。 Worked fine under Windows, but failed during build-job (Ubuntu).在 Windows 下工作正常,但在构建作业 (Ubuntu) 期间失败。 Quote the pattern and it works fine as in previous versions of eslint引用模式,它在 eslint 的早期版本中工作正常

"lint": "./node_modules/.bin/eslint \"**/*.js\""

Credit goes to https://github.com/eslint/eslint/issues/10599归功于https://github.com/eslint/eslint/issues/10599

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM