127.0.0.1:6000 ECONNREFUSED in MAC
himanshuoodles opened this issue · 12 comments
This modules is wonderful . On linux its working perfectly but on MAC OS its throwing some error when i try to createClient
.
Code:
var x11 = require('x11');
x11.createClient(function(err, display) {
if(err){
throw err;
}
xClient = display.client;
xClientDisplay = display;
});
Error:
on x11.createClient(function(err, display) { this gives an error
[697:0525/004703:ERROR:nw_shell.cc(336)] Error: connect ECONNREFUSED 127.0.0.1:6000
at Object.exports._errnoException (util.js:734:11)
at exports._exceptionWithHostPort (util.js:757:20)
at TCPConnectWrap.afterConnect as oncomplete
[697:0525/004703:INFO:CONSOLE(734)] "Uncaught Error: connect ECONNREFUSED 127.0.0.1:6000", source: util.js (734)
Do you have X server installed and running on mac? I'm using this one - https://www.xquartz.org/
NO i don't have . It is necessary to install this software. I am making a desktop app in node webkit , if i install this software that means if i install my desktop app in other MAC pc i have to install this software first to run x11 command
X Window system uses client/server architecture, clients connect to server ( "display server" in x11 terminology ) and server perform all visual stuff on behalf of the client. Yes, you need to have X Server running to use x11-based app. Unfortunately starting from Maverics it's not preinstalled on osx. If your target audience is mainly osx X11 is probably not the best choice
@himanshuoodles I am guessing you are using NW.js 0.12.x? It is based on io.js 1.2.0 which does not have the os.homedir()
function, which the version of node-x11 that is on npm uses. A while ago a commit of mine that fixes this (582bd1a) was merged but it is not in the node-x11 on npm yet.
You have two options: upgrade NW.js, or use node-x11 from git. (Or @sidorares can release a new x11 version to npm 😀)
After installation of xquatz in MAC os , I get this error.what i have done wrong
ERROR:nw_shell.cc(336)] TypeError: undefined is not a function
at readXauthority (/Users/Maneesh/Documents/productivity-front-desktopapp/node_modules/x11/lib/auth.js:56:57)
at module.exports (/Users/Maneesh/Documents/productivity-front-desktopapp/node_modules/x11/lib/auth.js:72:3)
at Object.writeClientHello (/Users/Maneesh/Documents/productivity-front-desktopapp/node_modules/x11/lib/handshake.js:194:5)
at XClient.startHandshake (/Users/Maneesh/Documents/productivity-front-desktopapp/node_modules/x11/lib/xcore.js:526:15)
at XClient.init (/Users/Maneesh/Documents/productivity-front-desktopapp/node_modules/x11/lib/xcore.js:113:10)
at Socket. (/Users/Maneesh/Documents/productivity-front-desktopapp/node_modules/x11/lib/xcore.js:602:20)
at emitNone (events.js:65:13)
at Socket.emit (events.js:147:7)
at PipeConnectWrap.afterConnect as oncomplete
[740:0525/022808:INFO:CONSOLE(56)] "Uncaught TypeError: undefined is not a function", source: /Users/Maneesh/Documents/productivity-front-desktopapp/node_modules/x11/lib/auth.js (56)
@himanshuoodles try replacing the x11 package installed from npm with the master branch on GitHub: npm i --save sidorares/node-x11
node-x11 (master) $ npm owner add polpo x11
+ polpo (x11)
@polpo if you don't mind :)
@sidorares excellent, thanks!
@himanshuoodles you can just upgrade node-x11 now by doing npm i --save x11
thanks @polpo @sidorares for your time . yes this work for me
@himanshuoodles feel free to reopen if there are more connection-related questions or create new issue if you need help on a different topic