在 windows 上使用 nodejs 安装 node-xmpp-bosh

Posted

技术标签:

【中文标题】在 windows 上使用 nodejs 安装 node-xmpp-bosh【英文标题】:Install node-xmpp-bosh with nodejs on windows 【发布时间】:2012-03-02 01:39:07 【问题描述】:

您好,我是 nodejs 的新手,我使用的是 windows 版本。我想按照安装说明安装我的 node-xmpp-bosh 服务器

 Go to the directory where you want to install 
node-xmpp-bosh (for a local install and move to 
setp-9) or follow step-8

$ cd ~/
$ npm install node-xmpp-bosh
$ node node_modules/node-xmpp-bosh/run-server.js

8. Install globally and run
$ npm install node-xmpp-bosh -g
$ bosh-server

但是在$ npm install node-xmpp-bosh之后 没有安装完成,这是nmp的日志文件:

     info it worked if it ends with ok
...    
       info node-expat@1.4.4 Failed to exec install script
    ERR! error installing node-expat@1.4.4
    info unbuild C:\Program Files\nodejs\node_modules\node-xmpp-bosh\node_modules\node-expat
    verbose from cache C:\Program Files\nodejs\node_modules\node-xmpp-bosh\node_modules\node-expat\package.json
    info preuninstall node-expat@1.4.4
    info uninstall node-expat@1.4.4
    verbose unbuild node-expat@1.4.4 [ false,
    verbose unbuild node-expat@1.4.4   'C:\\Program Files\\nodejs\\node_modules',
    verbose unbuild node-expat@1.4.4   'C:\\Program Files\\nodejs\\node_modules\\node-xmpp-bosh\\node_modules' ]
    info postuninstall node-expat@1.4.4
    verbose installOne cb node-expat@1.4.4
    verbose about to build C:\Program Files\nodejs\node_modules\node-xmpp-bosh
    ERR! error installing node-xmpp-bosh@0.5.6
    info unbuild C:\Program Files\nodejs\node_modules\node-xmpp-bosh
    verbose from cache C:\Program Files\nodejs\node_modules\node-xmpp-bosh\package.json
    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   'C:\\Program Files\\nodejs\\node_modules',
    verbose unbuild node-xmpp-bosh@0.5.6   'C:\\Program Files\\nodejs\\node_modules' ]
    verbose binRoot [ 'C:\\Program Files\\nodejs\\node_modules\\.bin',
    verbose binRoot    'bosh-server': './run-server.js'  ]
    info postuninstall node-xmpp-bosh@0.5.6
    ERR! error rolling back node-xmpp-bosh@0.5.6 Error: UNKNOWN, unknown error 'C:\Program Files\nodejs\node_modules\node-xmpp-bosh\node_modules\websocket'
    verbose installOne cb node-xmpp-bosh@0.5.6
    ERR! node-expat@1.4.4 install: `node-waf configure build`
    ERR! `cmd "/c" "node-waf configure build"` failed with 1
    ERR! 
    ERR! Failed at the node-expat@1.4.4 install script.
    ERR! This is most likely a problem with the node-expat package,
    ERR! not with npm itself.
    ERR! Tell the author that this fails on your system:
    ERR!     node-waf configure build
    ERR! You can get their info via:
    ERR!     npm owner ls node-expat
    ERR! There is likely additional logging output above.
    ERR! 
    ERR! System Windows_NT 5.1.2600
    ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "node-xmpp-bosh"
    ERR! cwd C:\Program Files\nodejs
    ERR! node -v v0.6.11
    ERR! npm -v 1.1.1
    ERR! code ELIFECYCLE
    ERR! message node-expat@1.4.4 install: `node-waf configure build`
    ERR! message `cmd "/c" "node-waf configure build"` failed with 1
    ERR! errno 
    verbose exit [ 1, true ]

我可以做些什么来解决这个问题 谢谢!

【问题讨论】:

【参考方案1】:

这可能会有所帮助:https://github.com/astro/node-expat/pull/23

【讨论】:

【参考方案2】:

看起来 node-xmpp-bosh 所依赖的 node-expat 模块使用了node-waf,这在 Windows 上不可用。

这里有更多信息:What is "node-waf" and how to get it on Windows?

除非你设法使用 Visual Studio 构建 node-expat 本机扩展,否则基本上看起来你不走运。

编辑:有人在此处编译了有关 Windows 上 node-waf 替代品的更多信息:https://***.com/a/9471319/288425

【讨论】:

以上是关于在 windows 上使用 nodejs 安装 node-xmpp-bosh的主要内容,如果未能解决你的问题,请参考以下文章

GitBook在Windows上安装及使用

Gitbook在Windows上安装

node.js中n支持windows吗

nodejs npm 安装平台特定包

sh 在Ubuntu for Windows上安装nodejs

nodejs项目可以在在windows上和mac上切换吗