Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Building Applications with React and Redux Getting Started with Redux Redux Initial Setup - index.js

Peter Mingione
Peter Mingione
14,122 Points

NPM local server won't start. I am getting an error with ESLint

Hi All,

I am on video 4 of the "Building Applications with React and Redux" series of videos. I have converted the App.js module to Scoreboard.js and I have installed all the dependencies. When I Try to start the server (npm start) I get an error (see below). It has something to do with ESLint. Thanks in advance for any help you can give me ....

Oops! Something went wrong! :(

ESLint: 7.7.0

No files matching the pattern "./src/*/.{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 ./src/**/*.{js, jsx} --fix

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! /Users/petermingione-macbook-home/.npm/_logs/2020-08-24T22_45_07_644Z-debug.log

npm ERR! code ELIFECYCLE

npm ERR! errno 2

npm ERR! [email protected] prestart: npm run lint

npm ERR! Exit status 2

npm ERR!

npm ERR! Failed at the [email protected] prestart 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! /Users/petermingione-macbook-home/.npm/_logs/2020-08-24T22_45_07_674Z-debug.log

7 Answers

Hi Peter

Can you check that the file path is correct. The relative path is relative to the package.json, not to the working directory.

lint: eslint ./src/*/.{js, jsx}

So the above should have some structure like this:

src/somefolder/some-file.js
package.json
...

Try specifying the extensions separate with the below command in your script

eslint —ext .jsx,.js  src/**/*

Or

eslint —ext .jsx,.js  src/

If that doesn’t work can you paste in the full log so I can see more details as to what’s going wrong /Users/petermingione-macbook-home/.npm/_logs/2020-08-24T22_45_07_674Z-debug.log

Hope this helps!

Peter Mingione
Peter Mingione
14,122 Points

Hi Liam, THanks for the help but I am very new to npm and React. I am not sure what all of the above means ...

YOU SAY: "Can you check that the file path is correct. The relative path is relative to the package.json, not to the working directory."

ME: I am not sure where I am looking for this.

I see this in package.js:

"lint": "eslint ./src/*/.{js, jsx} --fix"

YOU: "Try specifying the extensions separate with the below command in your script"

ME: I am not sure where to do this or even what it means.

YOU: "If that doesn’t work can you paste in the full log"

ME: Where would I find the full log?

Sorry.. again I don't know much about this. Can you give me the "For Dummies" version of all of this.

Peter Mingione
Peter Mingione
14,122 Points

Hi Liam, I found the log It is posted below.....

0 info it worked if it ends with ok 1 verbose cli [ '/usr/local/Cellar/node/10.9.0/bin/node', 1 verbose cli '/usr/local/bin/npm', 1 verbose cli 'start' ] 2 info using [email protected] 3 info using [email protected] 4 verbose run-script [ 'prestart', 'start', 'poststart' ] 5 info lifecycle [email protected]~prestart: [email protected] 6 verbose lifecycle [email protected]~prestart: unsafe-perm in lifecycle true 7 verbose lifecycle [email protected]~prestart: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/petermingione-macbook-home/react-projects/learn react course/5. React Redux Course (create-react-app : redux : react-redux)/react-redux/node_modules/.bin:/Users/petermingione-macbook-home/.rvm/gems/ruby-2.5.1/bin:/Users/petermingione-macbook-home/.rvm/gems/ruby-2.5.1@global/bin:/Users/petermingione-macbook-home/.rvm/rubies/ruby-2.5.1/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Users/petermingione-macbook-home/.rvm/bin 8 verbose lifecycle [email protected]~prestart: CWD: /Users/petermingione-macbook-home/react-projects/learn react course/5. React Redux Course (create-react-app : redux : react-redux)/react-redux 9 silly lifecycle [email protected]~prestart: Args: [ '-c', 'npm run lint' ] 10 silly lifecycle [email protected]~prestart: Returned: code: 2 signal: null 11 info lifecycle [email protected]~prestart: Failed to exec prestart script 12 verbose stack Error: [email protected] prestart: npm run lint 12 verbose stack Exit status 2 12 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16) 12 verbose stack at EventEmitter.emit (events.js:182:13) 12 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14) 12 verbose stack at ChildProcess.emit (events.js:182:13) 12 verbose stack at maybeClose (internal/child_process.js:961:16) 12 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:250:5) 13 verbose pkgid [email protected] 14 verbose cwd /Users/petermingione-macbook-home/react-projects/learn react course/5. React Redux Course (create-react-app : redux : react-redux)/react-redux 15 verbose Darwin 19.6.0 16 verbose argv "/usr/local/Cellar/node/10.9.0/bin/node" "/usr/local/bin/npm" "start" 17 verbose node v10.9.0 18 verbose npm v6.14.7 19 error code ELIFECYCLE 20 error errno 2 21 error [email protected] prestart: npm run lint 21 error Exit status 2 22 error Failed at the [email protected] prestart script. 22 error This is probably not a problem with npm. There is likely additional logging output above. 23 verbose exit [ 2, true ]

Peter Mingione
Peter Mingione
14,122 Points

2nd log file ....

0 info it worked if it ends with ok 1 verbose cli [ '/usr/local/Cellar/node/10.9.0/bin/node', 1 verbose cli '/usr/local/bin/npm', 1 verbose cli 'run', 1 verbose cli 'lint' ] 2 info using [email protected] 3 info using [email protected] 4 verbose run-script [ 'prelint', 'lint', 'postlint' ] 5 info lifecycle [email protected]~prelint: [email protected] 6 info lifecycle [email protected]~lint: [email protected] 7 verbose lifecycle [email protected]~lint: unsafe-perm in lifecycle true 8 verbose lifecycle [email protected]~lint: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/petermingione-macbook-home/react-projects/learn react course/5. React Redux Course (create-react-app : redux : react-redux)/react-redux/node_modules/.bin:/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/petermingione-macbook-home/react-projects/learn react course/5. React Redux Course (create-react-app : redux : react-redux)/react-redux/node_modules/.bin:/Users/petermingione-macbook-home/.rvm/gems/ruby-2.5.1/bin:/Users/petermingione-macbook-home/.rvm/gems/ruby-2.5.1@global/bin:/Users/petermingione-macbook-home/.rvm/rubies/ruby-2.5.1/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Users/petermingione-macbook-home/.rvm/bin 9 verbose lifecycle [email protected]~lint: CWD: /Users/petermingione-macbook-home/react-projects/learn react course/5. React Redux Course (create-react-app : redux : react-redux)/react-redux 10 silly lifecycle [email protected]~lint: Args: [ '-c', 'eslint ./src//*.{js, jsx} --fix' ] 11 silly lifecycle [email protected]~lint: Returned: code: 2 signal: null 12 info lifecycle [email protected]~lint: Failed to exec lint script 13 verbose stack Error: [email protected] lint: `eslint ./src//.{js, jsx} --fix 13 verbose stack Exit status 2 13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16) 13 verbose stack at EventEmitter.emit (events.js:182:13) 13 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14) 13 verbose stack at ChildProcess.emit (events.js:182:13) 13 verbose stack at maybeClose (internal/child_process.js:961:16) 13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:250:5) 14 verbose pkgid [email protected] 15 verbose cwd /Users/petermingione-macbook-home/react-projects/learn react course/5. React Redux Course (create-react-app : redux : react-redux)/react-redux 16 verbose Darwin 19.6.0 17 verbose argv "/usr/local/Cellar/node/10.9.0/bin/node" "/usr/local/bin/npm" "run" "lint" 18 verbose node v10.9.0 19 verbose npm v6.14.7 20 error code ELIFECYCLE 21 error errno 2 22 error [email protected] lint:eslint ./src//.{js, jsx} --fix` 22 error Exit status 2 23 error Failed at the [email protected] lint script. 23 error This is probably not a problem with npm. There is likely additional logging output above. 24 verbose exit [ 2, true ]

Peter Mingione
Peter Mingione
14,122 Points

0 info it worked if it ends with ok 1 verbose cli [ '/usr/local/Cellar/node/10.9.0/bin/node',

1 verbose cli '/usr/local/bin/npm', 1 verbose cli 'start' ]

2 info using [email protected]

3 info using [email protected]

4 verbose run-script [ 'prestart', 'start', 'poststart' ]

5 info lifecycle [email protected]~prestart: [email protected]

6 verbose lifecycle [email protected]~prestart: unsafe-perm in lifecycle true

7 verbose lifecycle [email protected]~prestart: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/petermingione-macbook-home/react-projects/learn react course/5. React Redux Course (create-react-app : redux : react-redux)/react-redux/node_modules/.bin:/Users/petermingione-macbook-home/.rvm/gems/ruby-2.5.1/bin:/Users/petermingione-macbook-home/.rvm/gems/ruby-2.5.1@global/bin:/Users/petermingione-macbook-home/.rvm/rubies/ruby-2.5.1/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Users/petermingione-macbook-home/.rvm/bin

8 verbose lifecycle [email protected]~prestart: CWD: /Users/petermingione-macbook-home/react-projects/learn react course/5. React Redux Course (create-react-app : redux : react-redux)/react-redux

9 silly lifecycle [email protected]~prestart: Args: [ '-c', 'npm run lint' ]

10 silly lifecycle [email protected]~prestart: Returned: code: 2 signal: null

11 info lifecycle [email protected]~prestart: Failed to exec prestart script

12 verbose stack Error: [email protected] prestart: npm run lint

12 verbose stack Exit status 2

12 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)

12 verbose stack at EventEmitter.emit (events.js:182:13)

12 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)

12 verbose stack at ChildProcess.emit (events.js:182:13)

12 verbose stack at maybeClose (internal/child_process.js:961:16)

12 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:250:5)

13 verbose pkgid [email protected]

14 verbose cwd /Users/petermingione-macbook-home/react-projects/learn react course/5. React Redux Course (create-react-app : redux : react-redux)/react-redux

15 verbose Darwin 19.6.0

16 verbose argv "/usr/local/Cellar/node/10.9.0/bin/node" "/usr/local/bin/npm" "start"

17 verbose node v10.9.0

18 verbose npm v6.14.7

19 error code ELIFECYCLE

20 error errno 2

21 error [email protected] prestart: npm run lint

21 error Exit status 2

22 error Failed at the [email protected] prestart script.

22 error This is probably not a problem with npm. There is likely additional logging output above.

23 verbose exit [ 2, true ]

Peter Mingione
Peter Mingione
14,122 Points

0 info it worked if it ends with ok

1 verbose cli [ '/usr/local/Cellar/node/10.9.0/bin/node',

1 verbose cli '/usr/local/bin/npm',

1 verbose cli 'run',

1 verbose cli 'lint' ]

2 info using [email protected]

3 info using [email protected]

4 verbose run-script [ 'prelint', 'lint', 'postlint' ]

5 info lifecycle [email protected]~prelint: [email protected]

6 info lifecycle [email protected]~lint: [email protected]

7 verbose lifecycle [email protected]~lint: unsafe-perm in lifecycle true

8 verbose lifecycle [email protected]~lint: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/petermingione-macbook-home/react-projects/learn react course/5. React Redux Course (create-react-app : redux : react-redux)/react-redux/node_modules/.bin:/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/petermingione-macbook-home/react-projects/learn react course/5. React Redux Course (create-react-app : redux : react-redux)/react-redux/node_modules/.bin:/Users/petermingione-macbook-home/.rvm/gems/ruby-2.5.1/bin:/Users/petermingione-macbook-home/.rvm/gems/ruby-2.5.1@global/bin:/Users/petermingione-macbook-home/.rvm/rubies/ruby-2.5.1/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Users/petermingione-macbook-home/.rvm/bin

9 verbose lifecycle [email protected]~lint: CWD: /Users/petermingione-macbook-home/react-projects/learn react course/5. React Redux Course (create-react-app : redux : react-redux)/react-redux

10 silly lifecycle [email protected]~lint: Args: [ '-c', 'eslint ./src/*/.{js, jsx} --fix' ]

11 silly lifecycle [email protected]~lint: Returned: code: 2 signal: null

12 info lifecycle [email protected]~lint: Failed to exec lint script

13 verbose stack Error: [email protected] lint: eslint ./src/**/*.{js, jsx} --fix

13 verbose stack Exit status 2

13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)

13 verbose stack at EventEmitter.emit (events.js:182:13)

13 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)

13 verbose stack at ChildProcess.emit (events.js:182:13)

13 verbose stack at maybeClose (internal/child_process.js:961:16)

13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:250:5)

14 verbose pkgid [email protected]

15 verbose cwd /Users/petermingione-macbook-home/react-projects/learn react course/5. React Redux Course (create-react-app : redux : react-redux)/react-redux

16 verbose Darwin 19.6.0

17 verbose argv "/usr/local/Cellar/node/10.9.0/bin/node" "/usr/local/bin/npm" "run" "lint"

18 verbose node v10.9.0

19 verbose npm v6.14.7

20 error code ELIFECYCLE

21 error errno 2

22 error [email protected] lint: eslint ./src/**/*.{js, jsx} --fix

22 error Exit status 2

23 error Failed at the [email protected] lint script.

23 error This is probably not a problem with npm. There is likely additional logging output above.

24 verbose exit [ 2, true ]

Hmm could be a dependency or caching issue but I believe its a versioning issue. Could you do the following steps just to be sure:

  1. Clean your node cache

    npm cache clean --force
    
  2. Remove your node_modules folder

    rm -rf node_modules/
    
  3. Fresh install

    npm install
    
  4. Run eslint script by itself

    npm run lint
    
  5. It looks like the error is triggering due to no files being found. Which it should as where you are at in the video, there is no files under src. If you go into your package.json and replace the lint script with the following. This is exactly the same as before with the --no-error-on-unmatched-pattern argument that will suppress the errors if nothing is found. Reference

    eslint ./src/**/*.{js, jsx} --fix --no-error-on-unmatched-pattern
    

As for the reasoning. This is due to the difference in versions. In the video, they are using eslint 3.3.1 and you are using 7.7.0. This was introduced in v6.x.

Good Luck!

Peter Mingione
Peter Mingione
14,122 Points

Hi Liam, Thank you for all of the help. I've followed the steps above but the server is still not starting. Here is the log output....

0 info it worked if it ends with ok

1 verbose cli [ '/usr/local/Cellar/node/10.9.0/bin/node',

1 verbose cli '/usr/local/bin/npm',

1 verbose cli 'start' ]

2 info using [email protected]

3 info using [email protected]

4 verbose run-script [ 'prestart', 'start', 'poststart' ]

5 info lifecycle [email protected]~prestart: [email protected]

6 verbose lifecycle [email protected]~prestart: unsafe-perm in lifecycle true

7 verbose lifecycle [email protected]~prestart: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/petermingione-macbook-home/react-projects/learn react course/5. React Redux Course (create-react-app : redux : react-redux)/react-redux-part-one/node_modules/.bin:/Users/petermingione-macbook-home/.rvm/gems/ruby-2.5.1/bin:/Users/petermingione-macbook-home/.rvm/gems/ruby-2.5.1@global/bin:/Users/petermingione-macbook-home/.rvm/rubies/ruby-2.5.1/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Users/petermingione-macbook-home/.rvm/bin

8 verbose lifecycle [email protected]~prestart: CWD: /Users/petermingione-macbook-home/react-projects/learn react course/5. React Redux Course (create-react-app : redux : react-redux)/react-redux-part-one

9 silly lifecycle [email protected]~prestart: Args: [ '-c', 'npm run lint' ]

10 silly lifecycle [email protected]~prestart: Returned: code: 0 signal: null

11 info lifecycle [email protected]~start: [email protected]

12 verbose lifecycle [email protected]~start: unsafe-perm in lifecycle true

13 verbose lifecycle [email protected]~start: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/petermingione-macbook-home/react-projects/learn react course/5. React Redux Course (create-react-app : redux : react-redux)/react-redux-part-one/node_modules/.bin:/Users/petermingione-macbook-home/.rvm/gems/ruby-2.5.1/bin:/Users/petermingione-macbook-home/.rvm/gems/ruby-2.5.1@global/bin:/Users/petermingione-macbook-home/.rvm/rubies/ruby-2.5.1/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Users/petermingione-macbook-home/.rvm/bin

14 verbose lifecycle [email protected]~start: CWD: /Users/petermingione-macbook-home/react-projects/learn react course/5. React Redux Course (create-react-app : redux : react-redux)/react-redux-part-one

15 silly lifecycle [email protected]~start: Args: [ '-c', 'webpack-dev-server --progress --inline --hot' ]

16 info lifecycle [email protected]~start: Failed to exec start script

17 verbose stack Error: [email protected] start: webpack-dev-server --progress --inline --hot

17 verbose stack spawn ENOENT

17 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:48:18)

17 verbose stack at ChildProcess.emit (events.js:182:13)

17 verbose stack at maybeClose (internal/child_process.js:961:16)

17 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:250:5)

18 verbose pkgid [email protected]

19 verbose cwd /Users/petermingione-macbook-home/react-projects/learn react course/5. React Redux Course (create-react-app : redux : react-redux)/react-redux-part-one

20 verbose Darwin 19.6.0

21 verbose argv "/usr/local/Cellar/node/10.9.0/bin/node" "/usr/local/bin/npm" "start"

22 verbose node v10.9.0

23 verbose npm v6.14.7

24 error code ELIFECYCLE

25 error syscall spawn

26 error file sh

27 error errno ENOENT

28 error [email protected] start: webpack-dev-server --progress --inline --hot

28 error spawn ENOENT

29 error Failed at the [email protected] start script.

29 error This is probably not a problem with npm. There is likely additional logging output above.

30 verbose exit [ 1, true ]