msf error in binding while exploiting blue

when i set my ip as a local host it give me following error

[] 10.10.10.40:445 - Connecting to target for exploitation.
[-] 10.10.10.40:445 - NameError
[-] 10.10.10.40:445 - uninitialized constant RubySMB::Error::CommunicationError
[-] 10.10.10.40:445 - /usr/share/metasploit-framework/modules/exploits/windows/smb/ms17_010_eternalblue.rb:167:in rescue in smb_eternalblue' /usr/share/metasploit-framework/modules/exploits/windows/ /usr/bin/msfconsole:48:in
[
] Exploit completed, but no session was created.

and when i try my hackthebox ip it gives me this error

Handler failed to bind to 10.10.10.12:4444:- -
[-] Handler failed to bind to 0.0.0.0:4444:- -
[-] 10.10.10.40:445 - Exploit failed [bad-config]: Rex::BindFailed The address is already in use or unavailable: (0.0.0.0:4444).
[*] Exploit completed, but no session was created.

where is the prob while using HTB ip exploiting completes but i get no session on it

You have to use LHOST the Hack The Box IP
Look at what IP tun0 gave you and use that
You should get something like:
[] 10.10.10.40:445 - Connecting to target for exploitation.
[+] 10.10.10.40:445 - Connection established for exploitation.
[+] 10.10.10.40:445 - Target OS selected valid for OS indicated by SMB reply
[
] 10.10.10.40:445 - CORE raw buffer dump (42 bytes)

@Cybernix said:
when i set my ip as a local host it give me following error

[] 10.10.10.40:445 - Connecting to target for exploitation.
[-] 10.10.10.40:445 - NameError
[-] 10.10.10.40:445 - uninitialized constant RubySMB::Error::CommunicationError
[-] 10.10.10.40:445 - /usr/share/metasploit-framework/modules/exploits/windows/smb/ms17_010_eternalblue.rb:167:in rescue in smb_eternalblue' /usr/share/metasploit-framework/modules/exploits/windows/ /usr/bin/msfconsole:48:in
[
] Exploit completed, but no session was created.

and when i try my hackthebox ip it gives me this error

Handler failed to bind to 10.10.10.12:4444:- -
[-] Handler failed to bind to 0.0.0.0:4444:- -
[-] 10.10.10.40:445 - Exploit failed [bad-config]: Rex::BindFailed The address is already in use or unavailable: (0.0.0.0:4444).
[*] Exploit completed, but no session was created.

where is the prob while using HTB ip exploiting completes but i get no session on it

ALL things oKAy …only u have to change your LPORT and LHOST…

i had issues on that box just cause its so busy so you might have to hammer it with the exploit a few times, pretty sure i ran it at least 4 times and it finally took

According to the error message, I understand that there few gems that needs to be installed. So I ran the command suggested along with the error message.

$ sudo bundle install
extconf failed, exit code 1
Gem files will remain installed in /usr/share/metasploit-framework/vendor/bundle/ruby/2.2.0/gems/nokogiri-1.6.8 for inspection.
Results logged to /usr/share/metasploit-framework/vendor/bundle/ruby/2.2.0/extensions/x86_64-linux/2.2.0/nokogiri-1.6.8/gem_make.out
An error occurred while installing nokogiri (1.6.8), and Bundler cannot
continue.
Make sure that gem install nokogiri -v 1.6.8` succeeds before bundling.

Regards,
Rachel Gomez