我想实现一个bash服务器。因为在Windows平台上很难,我决定通过VMware将其部署在Ubuntu虚拟机上。我进行了安装没有问题。我在这个页面上接受了这个过程:http://code.google.com/p/node-xmpp-bosh/wiki/DebianHowTo。现在我想在我什么都没有Starting bosh server.
的控制台上使用命令sudo bosh
或sudo /etc/init.d/bosh start
测试我的 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 bosh
时,我在终端上Starting 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
而且我的 bosh 服务器不起作用。
我运行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 node
,结果总是一样。当我运行node -v
并有v0.6.3
时,我认为这意味着节点已安装。我在home/node
上有节点目录.是路径问题吗?
我尝试运行npm install node-xmpp-bosh
,这是 npm-debug 上的结果.log:
...
info preuninstall node-xmpp-bosh@0.5.6
info uninstall node-xmpp-bosh@0.5.6
verbose unbuild node-xmpp-bosh@0.5.6 [ true,
verbose unbuild node-xmpp-bosh@0.5.6 '/home/frederic/node_modules',
verbose unbuild node-xmpp-bosh@0.5.6 '/home/frederic/node_modules' ]
verbose binRoot [ '/home/frederic/node_modules/.bin',
verbose binRoot { 'bosh-server': './run-server.js' } ]
info postuninstall node-xmpp-bosh@0.5.6
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! <npm-@googlegroups.com>
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 ]
/usr/bin/env: node: No such file or directory
这意味着bosh
被编写为对 shell 脚本使用一个奇怪的小习语:
#!/usr/bin/env node
这将运行env(1)
程序,该程序将在其PATH
中搜索node
可执行文件并使用修改后的环境执行它 - 但是,如果不修改环境,它只会node
运行。这有点愚蠢,但它也是编写脚本的最简单方法,该脚本不会对其解释器的路径进行硬编码。
您的系统上没有 node
程序可执行文件。也许node
尚未安装。(我有一个模糊的记忆,旧版本实际上被命名为nodejs
- 但我找不到支持这种记忆的文档。
若要确保已安装node
,请运行:
apt-get update && apt-get install -u nodejs
如果已安装nodejs
包,则可执行文件名称可能不同。运行 dpkg -L nodejs | grep bin
,并在输出中查找可执行文件名称。如果您没有看到/usr/bin/node
,我将帮助您设置符号链接。
要修复/usr/bin/env: node: No such file or directory
,您可以执行sudo apt-get install nodejs-legacy
我的一个服务员 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