2012-04-01 81 views
1

我想实现一个bosh服务器。由于在Windows平台上很难,我决定通过VMware将它部署在Ubuntu虚拟机上。我安装没有问题。我在这个页面上看到了这个过程:http://code.google.com/p/node-xmpp-bosh/wiki/DebianHowTo。 现在我想在控制台上使用命令sudo boshsudo /etc/init.d/bosh start来测试我的波什服务器。我有Starting bosh server.没有结果。ubuntu上的node-xmpp-bosh错误

我看看bosh.err文件,我看到exec: 2: /usr/local/lib/bosh/run-server.js: Permission denied我不知道为什么这个错误与sudo


我给了可执行权限,如dhruvbird说:chmod +x /usr/local/lib/bosh/run-server.js

现在,当我执行命令sudo boshStarting bosh在终端上和bosh.err有这样的:

node.js:201 
     throw e; // process.nextTick error, or 'error' event on first tick 
      ^
Error: Cannot find module 'ltx' 
    at Function._resolveFilename (module.js:334:11) 
    at Function._load (module.js:279:25) 
    at Module.require (module.js:357:17) 
    at require (module.js:368:17) 
    at Object.<anonymous> (/usr/local/lib/bosh/src/bosh.js:26:19) 
    at Module._compile (module.js:432:26) 
    at Object..js (module.js:450:10) 
    at Module.load (module.js:351:31) 
    at Function._load (module.js:310:12) 
    at Module.require (module.js:357:17)̍ 

当我执行命令sudo /etc/init.d/bosh start我总是有Starting bosh在终端上,这对bosh.err

/usr/bin/env: node: No such file or directory

而我的波什服务器无法正常工作。


我跑dpkg -L nodejs | grep bindpkg -L node | grep bin,我可以读取包未安装每个测试。我运行了apt-get update && apt-get install -u nodejsapt-get update && apt-get install -u node,结果始终如此。当我运行node -v并有v0.6.3,我想这意味着该节点是安装。我有home/node上的节点目录。这是路径问题吗?


我尝试运行npm install node-xmpp-bosh,这是NPM-的的debug.log结果:

... 
info preuninstall [email protected] 
info uninstall [email protected] 
verbose unbuild [email protected] [ true, 
verbose unbuild [email protected] '/home/frederic/node_modules', 
verbose unbuild [email protected] '/home/frederic/node_modules' ] 
verbose binRoot [ '/home/frederic/node_modules/.bin', 
verbose binRoot { 'bosh-server': './run-server.js' } ] 
info postuninstall [email protected] 
ERR! Error: shasum check failed for /tmp/npm-1333573304110/1333573499309-0.1599154758732766/tmp.tgz 
ERR! Expected: 1ceb545541dce5531c12187b80de902718a6afd2 
ERR! Actual: a3920de4ba03316b05b8c94163ea39ba3db434cc 
ERR!  at /usr/local/lib/node_modules/npm/lib/utils/sha.js:25:20 
ERR!  at [object Object].<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/sha.js:49:5) 
ERR!  at [object Object].emit (events.js:64:17) 
ERR!  at afterRead (fs.js:1111:12) 
ERR!  at Object.wrapper [as oncomplete] (fs.js:254:17) 
ERR! You may report this log at: 
ERR!  <http://github.com/isaacs/npm/issues> 
ERR! or email it to: 
ERR!  <[email protected]> 
ERR! 
ERR! System Linux 3.0.0-12-generic 
ERR! command "node" "/usr/local/bin/npm" "install" "node-xmpp-bosh" 
ERR! cwd /home/frederic 
ERR! node -v v0.6.3 
ERR! npm -v 1.1.15 
ERR! message shasum check failed for /tmp/npm-1333573304110/1333573499309-0.1599154758732766/tmp.tgz 
ERR! message Expected: 1ceb545541dce5531c12187b80de902718a6afd2 
ERR! message Actual: a3920de4ba03316b05b8c94163ea39ba3db434cc 
verbose exit [ 1, true ] 
+0

什么'LS -l/usr/local/lib/bosh/run-server.js' show? – sarnold 2012-04-01 23:03:39

+0

It shoes:'-rw -r - r-- 1 root root 4889 2012-04-01 18:50/usr/local/lib/bosh/run-server.js' – megueloby 2012-04-02 11:12:03

+0

您可能需要为该脚本提供可执行文件权限:chmod + x /usr/local/lib/bosh/run-server.js – dhruvbird 2012-04-03 18:17:14

回答

1
/usr/bin/env: node: No such file or directory 

这意味着bosh已写入使用shell脚本一个奇怪的小成语:

#!/usr/bin/env node 

运行env(1)程序,该程序将搜索其PATHnode可执行文件并使用修改后的环境执行它 - 但是,如果不进行环境修改,它只会运行node。这有点愚蠢,但它也是编写脚本的最简单方法,不会对解释器的路径进行硬编码。

您的系统上没有node程序可执行文件。或许node尚未安装。 (我有一个模糊的记忆是旧版本实际上是一个名为nodejs - 但我无法找到的文件来支持这种内存。)

要确保node安装,运行:

apt-get update && apt-get install -u nodejs 

如果nodejs包已经安装,那么可能的可执行名称是不同的。运行dpkg -L nodejs | grep bin,并在输出中查找可执行文件的名称。如果您没有看到/usr/bin/node,我会帮助您设置符号链接。

+0

我运行dpkg -L nodejs | grep bin或dpkg -L node | grep bin,我可以看到这个软件包并没有为每个测试安装。我运行apt-get update && apt-get install -u nodejs和apt-get update && apt-get install -u节点,结果始终如此。 – megueloby 2012-04-04 12:08:25

+0

嗨,如何建立一个符号链接,首先它是什么意思? – megueloby 2012-04-10 23:10:40

0

要解决/usr/bin/env: node: No such file or directory可以执行sudo apt-get install nodejs-legacy

0

我对我的servsers CentOS版本6.4(决赛)的一个同样的问题 我一直在使用这些命令修正它:

# yum install nodejs 
# yum install npm 
# npm install ltx 
# npm install underscore 
# npm install node-lumberjack 
# npm install node-uuid 
# npm install eventpipe 
# npm install node-expat 
# npm install ejs 
# npm install dns-srv 
# npm install tav 
# npm install ws