2014-10-30 22 views
0

我按照這個指令http://crossbar.io/docs/Getting-started-with-NodeJS/,我可以通過localhost:8080訪問前端,但似乎在後端沒有執行hello.js。這是日誌我運行後crossbar startCrossbar.io - WAMP路由器不工作

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. ]

話雖然前端不斷髮布對通道「onhello」,但服務器尚未收到並記錄任何東西。什麼是錯誤,誰能幫我解決這個問題?謝謝。

回答

0

Crossbar.io無法找到NodeJS可執行文件。它需要config.json中的完全合格路徑。

E.g.在Ubuntu上,是的NodeJS下/usr/bin/nodejs安裝,並且使這項工作在默認情況下產生的Crossbar.io節點配置,你需要做的:

sudo ln -s /usr/bin/nodejs /usr/bin/node 

等你拿

[email protected]:~/temp/node4$ ls -la /usr/bin/node 
lrwxrwxrwx 1 root root 15 Okt 31 09:35 /usr/bin/node -> /usr/bin/nodejs 
[email protected]:~/temp/node4$ ls -la /usr/bin/nodejs 
-rwxr-xr-x 1 root root 1462424 Mär 27 2014 /usr/bin/nodejs 
+0

非常感謝!我使用Mac OS X並注意Node可執行文件位於/ usr/local/bin下。改變config.json中的路徑和一切工作 – user3324363 2014-11-01 15:41:02