I have followed this instruction http://crossbar.io/docs/Getting-started-with-NodeJS/ and I can access to frontend via localhost:8080
, but seem like hello.js in backend side had not been executed. This is the log after I run crossbar start
:
2014-10-30 23:52:33+0700 [Controller 48946] Log opened.
2014-10-30 23:52:33+0700 [Controller 48946] ============================== Crossbar.io ==============================
2014-10-30 23:52:33+0700 [Controller 48946] Crossbar.io 0.9.9 starting
2014-10-30 23:52:34+0700 [Controller 48946] Running on CPython using KQueueReactor reactor
2014-10-30 23:52:34+0700 [Controller 48946] Starting from node directory /Users/toannguyen/Documents/Local-Repo/crossbar-hello/.crossbar
2014-10-30 23:52:34+0700 [Controller 48946] Starting from local configuration '/Users/toannguyen/Documents/Local-Repo/crossbar-hello/.crossbar/config.json'
2014-10-30 23:52:34+0700 [Controller 48946] No WAMPlets detected in enviroment.
2014-10-30 23:52:34+0700 [Controller 48946] Starting Router with ID 'worker1' ..
2014-10-30 23:52:35+0700 [Router 48950] Log opened.
2014-10-30 23:52:36+0700 [Router 48950] Running under CPython using KQueueReactor reactor
2014-10-30 23:52:36+0700 [Router 48950] Entering event loop ..
2014-10-30 23:52:36+0700 [Controller 48946] Router with ID 'worker1' and PID 48950 started
2014-10-30 23:52:36+0700 [Controller 48946] Router 'worker1': realm 'realm1' started
2014-10-30 23:52:36+0700 [Controller 48946] Router 'worker1': role 'role1' started on realm 'realm1'
2014-10-30 23:52:36+0700 [Router 48950] Site starting on 8080
2014-10-30 23:52:36+0700 [Controller 48946] Router 'worker1': transport 'transport1' started
2014-10-30 23:52:36+0700 [Controller 48946] Starting Guest with ID 'worker2' ..
2014-10-30 23:52:36+0700 [Controller 48946] GuestWorkerClientProtocol.connectionMade
2014-10-30 23:52:36+0700 [Controller 48946] Guest with ID 'worker2' and PID 48951 started
2014-10-30 23:52:36+0700 [Controller 48946] Warning: cannot watch directory for changes - feature DirWatcher unavailable
2014-10-30 23:52:36+0700 [Controller 48946] Guest 'worker2': started
2014-10-30 23:52:36+0700 [Guest 48951] Upon execvpe /usr/bin/node ['/usr/bin/node', 'hello.js'] in environment id 4347382592
2014-10-30 23:52:36+0700 [Guest 48951] :Traceback (most recent call last):
2014-10-30 23:52:36+0700 [Guest 48951] File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/twisted/internet/process.py", line 403, in _fork
2014-10-30 23:52:36+0700 [Guest 48951] path, uid, gid, executable, args, environment)
2014-10-30 23:52:36+0700 [Guest 48951] File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/twisted/internet/process.py", line 453, in _execChild
2014-10-30 23:52:36+0700 [Guest 48951] os.execvpe(executable, args, environment)
2014-10-30 23:52:36+0700 [Guest 48951] File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 355, in execvpe
2014-10-30 23:52:36+0700 [Guest 48951] _execvpe(file, args, env)
2014-10-30 23:52:36+0700 [Guest 48951] File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 370, in _execvpe
2014-10-30 23:52:36+0700 [Guest 48951] func(file, *argrest)
2014-10-30 23:52:36+0700 [Guest 48951] OSError: [Errno 2] No such file or directory
2014-10-30 23:52:36+0700 [Controller 48946] GuestWorkerClientProtocol.connectionLost: [Failure instance: Traceback (failure with no frames): : A process has ended with a probable error condition: process ended with exit code 1. ]
2014-10-30 23:52:36+0700 [Controller 48946] GuestWorkerClientProtocol: guest ended with error 1
2014-10-30 23:52:36+0700 [Controller 48946] Guest excited with error [Failure instance: Traceback (failure with no frames): : A process has ended with a probable error condition: process ended with exit code 1. ]
Then although frontend keeps publishing on channel 'onhello', but server has not received and logged anything. What is the errors and could anyone help me to fix this? Thanks.
Crossbar.io cannot find the NodeJS executable. It needs the fully qualified path in the config.json
.
E.g. on Ubuntu, NodeJS is installed under /usr/bin/nodejs
, and to make that work with the Crossbar.io node configuration generated by default, you need to do:
sudo ln -s /usr/bin/nodejs /usr/bin/node
so you get
oberstet@ubuntu1404:~/temp/node4$ ls -la /usr/bin/node
lrwxrwxrwx 1 root root 15 Okt 31 09:35 /usr/bin/node -> /usr/bin/nodejs
oberstet@ubuntu1404:~/temp/node4$ ls -la /usr/bin/nodejs
-rwxr-xr-x 1 root root 1462424 Mär 27 2014 /usr/bin/nodejs