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
10,419 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! react-redux-course@1.0.0 lint: eslint ./src/**/*.{js, jsx} --fix

npm ERR! Exit status 2

npm ERR!

npm ERR! Failed at the react-redux-course@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! /Users/petermingione-macbook-home/.npm/_logs/2020-08-24T22_45_07_644Z-debug.log

npm ERR! code ELIFECYCLE

npm ERR! errno 2

npm ERR! react-redux-course@1.0.0 prestart: npm run lint

npm ERR! Exit status 2

npm ERR!

npm ERR! Failed at the react-redux-course@1.0.0 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
10,419 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
10,419 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 npm@6.14.7 3 info using node@v10.9.0 4 verbose run-script [ 'prestart', 'start', 'poststart' ] 5 info lifecycle react-redux-course@1.0.0~prestart: react-redux-course@1.0.0 6 verbose lifecycle react-redux-course@1.0.0~prestart: unsafe-perm in lifecycle true 7 verbose lifecycle react-redux-course@1.0.0~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 react-redux-course@1.0.0~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 react-redux-course@1.0.0~prestart: Args: [ '-c', 'npm run lint' ] 10 silly lifecycle react-redux-course@1.0.0~prestart: Returned: code: 2 signal: null 11 info lifecycle react-redux-course@1.0.0~prestart: Failed to exec prestart script 12 verbose stack Error: react-redux-course@1.0.0 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 react-redux-course@1.0.0 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 react-redux-course@1.0.0 prestart: npm run lint 21 error Exit status 2 22 error Failed at the react-redux-course@1.0.0 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
10,419 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 npm@6.14.7 3 info using node@v10.9.0 4 verbose run-script [ 'prelint', 'lint', 'postlint' ] 5 info lifecycle react-redux-course@1.0.0~prelint: react-redux-course@1.0.0 6 info lifecycle react-redux-course@1.0.0~lint: react-redux-course@1.0.0 7 verbose lifecycle react-redux-course@1.0.0~lint: unsafe-perm in lifecycle true 8 verbose lifecycle react-redux-course@1.0.0~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 react-redux-course@1.0.0~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 react-redux-course@1.0.0~lint: Args: [ '-c', 'eslint ./src//*.{js, jsx} --fix' ] 11 silly lifecycle react-redux-course@1.0.0~lint: Returned: code: 2 signal: null 12 info lifecycle react-redux-course@1.0.0~lint: Failed to exec lint script 13 verbose stack Error: react-redux-course@1.0.0 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 react-redux-course@1.0.0 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 react-redux-course@1.0.0 lint:eslint ./src//.{js, jsx} --fix` 22 error Exit status 2 23 error Failed at the react-redux-course@1.0.0 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
10,419 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 npm@6.14.7

3 info using node@v10.9.0

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

5 info lifecycle react-redux-course@1.0.0~prestart: react-redux-course@1.0.0

6 verbose lifecycle react-redux-course@1.0.0~prestart: unsafe-perm in lifecycle true

7 verbose lifecycle react-redux-course@1.0.0~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 react-redux-course@1.0.0~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 react-redux-course@1.0.0~prestart: Args: [ '-c', 'npm run lint' ]

10 silly lifecycle react-redux-course@1.0.0~prestart: Returned: code: 2 signal: null

11 info lifecycle react-redux-course@1.0.0~prestart: Failed to exec prestart script

12 verbose stack Error: react-redux-course@1.0.0 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 react-redux-course@1.0.0

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 react-redux-course@1.0.0 prestart: npm run lint

21 error Exit status 2

22 error Failed at the react-redux-course@1.0.0 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
10,419 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 npm@6.14.7

3 info using node@v10.9.0

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

5 info lifecycle react-redux-course@1.0.0~prelint: react-redux-course@1.0.0

6 info lifecycle react-redux-course@1.0.0~lint: react-redux-course@1.0.0

7 verbose lifecycle react-redux-course@1.0.0~lint: unsafe-perm in lifecycle true

8 verbose lifecycle react-redux-course@1.0.0~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 react-redux-course@1.0.0~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 react-redux-course@1.0.0~lint: Args: [ '-c', 'eslint ./src/*/.{js, jsx} --fix' ]

11 silly lifecycle react-redux-course@1.0.0~lint: Returned: code: 2 signal: null

12 info lifecycle react-redux-course@1.0.0~lint: Failed to exec lint script

13 verbose stack Error: react-redux-course@1.0.0 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 react-redux-course@1.0.0

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 react-redux-course@1.0.0 lint: eslint ./src/**/*.{js, jsx} --fix

22 error Exit status 2

23 error Failed at the react-redux-course@1.0.0 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
10,419 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 npm@6.14.7

3 info using node@v10.9.0

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

5 info lifecycle react-redux-course@1.0.0~prestart: react-redux-course@1.0.0

6 verbose lifecycle react-redux-course@1.0.0~prestart: unsafe-perm in lifecycle true

7 verbose lifecycle react-redux-course@1.0.0~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 react-redux-course@1.0.0~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 react-redux-course@1.0.0~prestart: Args: [ '-c', 'npm run lint' ]

10 silly lifecycle react-redux-course@1.0.0~prestart: Returned: code: 0 signal: null

11 info lifecycle react-redux-course@1.0.0~start: react-redux-course@1.0.0

12 verbose lifecycle react-redux-course@1.0.0~start: unsafe-perm in lifecycle true

13 verbose lifecycle react-redux-course@1.0.0~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 react-redux-course@1.0.0~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 react-redux-course@1.0.0~start: Args: [ '-c', 'webpack-dev-server --progress --inline --hot' ]

16 info lifecycle react-redux-course@1.0.0~start: Failed to exec start script

17 verbose stack Error: react-redux-course@1.0.0 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 react-redux-course@1.0.0

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 react-redux-course@1.0.0 start: webpack-dev-server --progress --inline --hot

28 error spawn ENOENT

29 error Failed at the react-redux-course@1.0.0 start script.

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

30 verbose exit [ 1, true ]