Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I ran the next command: "npm start" which was configured in my package.json like this:

"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:

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! [email protected] lint: `eslint **/*.js` npm ERR! Exit status 2 npm ERR!  npm ERR! Failed at the [email protected] 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. Also, joknawe points out that maybe eslint is trying to lint my node_modules directory but i don't know how to ignore it.

Is there any way to solve this issue ?

like image 283
enbermudas Avatar asked Jun 26 '18 13:06

enbermudas


3 Answers

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.

like image 58
Manohar Reddy Poreddy Avatar answered Oct 16 '22 12:10

Manohar Reddy Poreddy


I've solved the exact same issue by changing

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

to

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

Hope this help.

like image 42
JeffMinsungKim Avatar answered Oct 16 '22 10:10

JeffMinsungKim


I had the same issue. Worked fine under Windows, but failed during build-job (Ubuntu). Quote the pattern and it works fine as in previous versions of eslint

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

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

like image 20
Michael Christopher Avatar answered Oct 16 '22 12:10

Michael Christopher