ESLint:5.0.1错误

时间:2018-06-26 13:54:23

标签: javascript node.js express npm eslint

我正在按照本教程创建项目:Full Stack Web App using Vue.js & Express.js: Part 1 - Intro

我运行了下一个命令:“ 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"
      },

但是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)

我知道昨天有another thread个问题,但是除非我有50个声誉,否则我无法对此发表评论。另外,joknawe指出,也许eslint试图抹掉我的node_modules目录,但我不知道如何忽略它。

有什么办法解决这个问题?

3 个答案:

答案 0 :(得分:0)

我已经通过更改解决了完全相同的问题

  

“ lint”:“ ./node_modules/.bin/eslint ** / *。js”

  

“ lint”:“ ./node_modules/.bin/eslint src / *。js”

希望获得帮助。

答案 1 :(得分:0)

我有同样的问题。在Windows下工作正常,但在构建作业(Ubuntu)期间失败。引用该模式,它可以像以前的eslint版本一样正常工作

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

贷方转到 https://github.com/eslint/eslint/issues/10599

答案 2 :(得分:0)

通过:

// Windows - Pass  
// Ubuntu - Pass

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

失败#1

// Windows - Fail -  "Oops! Something went wrong! :("  
// Ubuntu - Pass

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

失败#2

// Windows - Pass  
// Ubuntu - Fail  

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

希望有帮助。