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 Build a REST API With Express Modeling Data for the API Connecting Mongoose to MongoDB

Erik L
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Erik L
Full Stack JavaScript Techdegree Graduate 19,470 Points

I get a strange error when running mongod on terminal

So I noticed that when I run mongod on visual studio code I get this: Failed to set up listener: SocketException: Address already in use, which is strange since I closed all my terminal windows, how can I resolve this?

Eriks-MacBook-Pro:stage_4_start eriklopezramirez$ mongod
2019-02-16T00:28:03.866-0500 I CONTROL  [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols
 'none'
2019-02-16T00:28:03.881-0500 I CONTROL  [initandlisten] MongoDB starting : pid=3017 port=27017 dbpath=/data/db 64-bit host=Eriks-MacBo
ok-Pro.local
2019-02-16T00:28:03.881-0500 I CONTROL  [initandlisten] db version v4.0.3
2019-02-16T00:28:03.881-0500 I CONTROL  [initandlisten] git version: 7ea530946fa7880364d88c8d8b6026bbc9ffa48c
2019-02-16T00:28:03.881-0500 I CONTROL  [initandlisten] allocator: system
2019-02-16T00:28:03.881-0500 I CONTROL  [initandlisten] modules: none
2019-02-16T00:28:03.881-0500 I CONTROL  [initandlisten] build environment:
2019-02-16T00:28:03.881-0500 I CONTROL  [initandlisten]     distarch: x86_64
2019-02-16T00:28:03.881-0500 I CONTROL  [initandlisten]     target_arch: x86_64
2019-02-16T00:28:03.881-0500 I CONTROL  [initandlisten] options: {}
2019-02-16T00:28:03.881-0500 E STORAGE  [initandlisten] Failed to set up listener: SocketException: Address already in use
2019-02-16T00:28:03.881-0500 I CONTROL  [initandlisten] now exiting
2019-02-16T00:28:03.881-0500 I CONTROL  [initandlisten] shutting down with code:48

1 Answer

Brendan Whiting
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Brendan Whiting
Front End Web Development Techdegree Graduate 84,735 Points

See this StackOverflow answer on the subject of this bug: Failed to set up listener: SocketException: Address already in use,

My guess is that you're already running mongo. Two things can't both run on the same port.