我在Windows8机器上安装了tower@0.4.2-22。在此之后,我尝试验证安装。我启动了mongod,塔式服务器,并在我的浏览器中调用http://localhost:3000。我收到错误消息(在浏览器窗口和服务器日志中):TypeError: Object Windows8没有方法'match‘at Object.Tower.MiddlewareAgent as handle at next (C:\Users\Philipp\Documents\Scripts\tower\Tests\test01\node_modules\tower\node_modules\connect\lib\proto.js:199:15) at Object.handle (C:\Users\Philipp\Documents\Scripts\tower\Tests\test01\app\config\server\bootstrap.coffee:23:14)在multipart (C:\Users\Philipp\Documents\Scripts\tower\Tests\test01\node_modules的next (C:\Users\Philipp\Documents\Scripts\tower\Tests\test01\node_modules\tower\node_modules\connect\lib\proto.js:199:15) at Object.methodOverride as handle at next (C:\Users\Philipp\Documents\Scripts\tower\Tests\test01\node_modules模块中urlencoded (C:\Users\Philipp\Documents\Scripts\tower\Tests\test01\node_modules\tower\node_modules\connect\lib\middleware\urlencoded.js:51:37)处的\tower\node_modules\connect\lib\middleware\multipart.js:64:37) at module.exports (C:\Users\Philipp\Documents\Scripts\tower\Tests\test01\node_modules\tower\node_modules\connect\lib\middleware\bodyParser.js:57:9)。导出(C:\Users\Philipp\Documents\Scripts\tower\Tests\test01\node_modules\tower\node_modules\connect\lib\middleware\bodyParser.js:55:7)
我试图弄清楚发生了什么,并发现在模块\node_modules\tower\lib\tower-middleware\server\agent.js中,方法调用mac:!!agent.os.match(/mac/i),windows:!!agent.os.match(/win/i),linux:!!agent.os.match(/linux/i)失败,因为agent.os是object类型而不是string类型。我用mac:!!agent.os.toString().match(/mac/i),windows:!!agent.os.toString().match(/win/i),linux:!!agent.os.toString().match(/linux/i)替换了这几行,然后塔启动并运行。
这是代码中的错误还是我的安装有问题?
首先,我用npm安装了-g,然后我用塔式新test01创建了一个应用程序,接下来的步骤是:- cd test01 - npm安装-永远的server.js (失败的永远没有安装)- npm安装永远的-g -永远的server.js (失败的mongodb没有启动)-(启动了mongodb) -永远的server.js (现在正在运行)-蛋糕手表(在另一个提示中-失败,因为grunt丢失)- npm安装grunt -g -蛋糕手表(现在它正在运行)-(转到浏览器并输入http://localhost:3000) -(参见上面的错误描述)
发布于 2013-01-11 21:53:07
似乎是最近的一个错误,可能是在最近的node.js版本或塔的其他依赖项中发生了变化,我注意到塔在过去的几天里突然收到了一些关于这方面的错误报告,看起来像someone submitted a patch last night,所以请注意拉取请求是否被接受,或者将其拉入到您自己的tower.js分支中并重试。
https://stackoverflow.com/questions/14256315
复制相似问题