Express.js + lint gives mistake
I am watching this lesson and trying to recreate everything author does. At 19:00 he sets vue.js-express.js project. He creates folder called ‘server’. In ‘server/’ he runs ‘npm init -f’. Then ‘npm install –save nodemon eslint’, then he inits eslint.
Then in package.json file he writes:

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

Then in folder ‘server’ he creates folder ‘src’. In ‘src’ he creates ‘app.js’. And in ‘app.js; there is a simple console.log(‘hello’).
Then he runs ‘npm start’. ‘Hello’ is printed in terminal, nodemon and eslint works just fine. Then he types ‘npm install –save express’. Thats where my problem begins. After installing express.js i type ‘npm start’ and i get this error in terminal:

Oops! Something went wrong! :(

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

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/r/.npm/_logs/2018-06-25T10_32_02_027Z-debug.log
[nodemon] process failed, unhandled exit code (2)
[nodemon] Error
at Bus.utils.bus.on (/home/r/projects/tab-tracker/server/node_modules    /nodemon/lib/nodemon.js:148:25)
    at Bus.emit (events.js:164:20)
at ChildProcess.<anonymous> (/home/r/projects/tab-tracker/server/node_modules/nodemon/lib/monitor/run.js:164:11)
at ChildProcess.emit (events.js:159:13)
at Process.ChildProcess._handle.onexit (internal/child_process.js:209:12)

Why is this happening?

Here is Solutions:

We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.

Solution 1

Quote the pattern and it works fine as in previous versions of eslint

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

Credit goes to

Solution 2

@joknawe in comments gave right answer, thanks.

Looks like maybe it is trying to lint your node_modules directory. This should be ignored by default, but your wildcard **/*.js may be causing the issue. Try just using eslint

Solution 3

Replace your code

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


"start": "nodemon src/app.js --exec 'npm run lint && node'",
"lint": "eslint"

Solution 4

I use WSL and i fixed by changing following line.


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


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

Solution 5

In a Mac I fixed it just changing the following line


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


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

Solution 6

Just add quotes around the wildcard **/*.js.

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

Solution 7

in .eslint.js file you should replace this code


"browser": true


"node": true

Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply