running towerjs on windows 8 gives a TypeError

134 Views Asked by At

I installed [email protected] on my windows 8 machine. After this I tried to verify the installation. I started mongod server, the tower server and called http://localhost:3000 in my browser. I get the error messages (in browser window and server log): TypeError: Object Windows 8 has no method 'match' at Object.Tower.MiddlewareAgent [as handle] (C:\Users\Philipp\Documents\Scripts\tower\Tests\test01\node_modules\tower\lib\tower-middleware\server\agent.js:13:21) 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) at 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] (C:\Users\Philipp\Documents\Scripts\tower\Tests\test01\node_modules\tower\node_modules\connect\lib\middleware\methodOverride.js:37:5) at next (C:\Users\Philipp\Documents\Scripts\tower\Tests\test01\node_modules\tower\node_modules\connect\lib\proto.js:199:15) at multipart (C:\Users\Philipp\Documents\Scripts\tower\Tests\test01\node_modules\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) at urlencoded (C:\Users\Philipp\Documents\Scripts\tower\Tests\test01\node_modules\tower\node_modules\connect\lib\middleware\urlencoded.js:51:37) at module.exports (C:\Users\Philipp\Documents\Scripts\tower\Tests\test01\node_modules\tower\node_modules\connect\lib\middleware\bodyParser.js:55:7)

I tried to figure out what's happened and find out that in module \node_modules\tower\lib\tower-middleware\server\agent.js the method calls mac: !!agent.os.match(/mac/i), windows: !!agent.os.match(/win/i), linux: !!agent.os.match(/linux/i) failed because agent.os is of type object and not string. I replaced the lines with mac: !!agent.os.toString().match(/mac/i), windows: !!agent.os.toString().match(/win/i), linux: !!agent.os.toString().match(/linux/i) and tower comes up and is running.

Is this a bug in the code or was something wrong with my installation?

First I installed tower with npm install power -g Then I created a app with tower new test01 The next steps were: - cd test01 - npm install - forever server.js (failed forever wasn't installed) - npm install forever -g - forever server.js (failed mongod wasn't started) - (started mongodb) - forever server.js (is running now) - cake watch (in another prompt - failed, because grunt missing) - npm install grunt -g - cake watch (now it's running) - (go to browser and enter http://localhost:3000) - (see error description above)

1

There are 1 best solutions below

0
On

Seems to be a recent bug, probably something that has changed in recent versions of node.js or one of Tower's other depencies, I noticed tower has suddenly gotten a few bug reports for this over the past couple of days, and looks like someone submitted a patch last night so watch for either that pull request to get accepted or pull it into your own fork of tower.js and try again.