tower-archive / tower

UNMAINTAINED - Small components for building apps, manipulating data, and automating a distributed infrastructure.
http://tower.github.io
MIT License
1.79k stars 120 forks source link

fix agent detection bug: TypeError: Object Mac OS X 10.8.2 has no method 'match' #376

Closed svasva closed 11 years ago

svasva commented 11 years ago

fix exception: TypeError: Object Mac OS X 10.8.2 has no method 'match'     at Object.Tower.MiddlewareAgent as handle

jisaacks commented 11 years ago

This fixed for me too. When will a new release with this fix be released? I just manually edited my local install for now.

svasva commented 11 years ago

you can set npm to use the git-master package, like this (in package.json):

{
...
    "tower": "git://github.com/viatropos/tower.git",
...
}
jisaacks commented 11 years ago

@erundook thanks I was trying to figure out how to do that!

juanpaco commented 11 years ago

@jisaacks - once you fixed it in your local installation, how did you get that change to be picked up by your server? I made the same change, and I get the same error. I also put a console.log in that function, and I didn't see the console.log output. Then I put in some very obviously syntactically incorrect garbage, and it didn't fail on that either, which leads me to believe there's some sort of compilation step required to get that change picked up.

jisaacks commented 11 years ago

@juanpaco I don't recall doing anything except restarting the server.

juanpaco commented 11 years ago

Well shucks, okay. Thanks for the reply.

I blew away my node_modules directory and then pointed the packages at the git-master package, so I'm up and running again.

RobbieTheWagner commented 11 years ago

Can someone please explain how to fix this error in detail? I've spent the past hour trying to figure it out. @erundook @juanpaco @jisaacks @viatropos

bryanhales commented 11 years ago

@rwwagner90 In your project, go to node_modules/tower/lib/tower-middleware/server/agent.js and replace lines 13-15 with:

mac: !!agent.os.family.match(/mac/i),
windows: !!agent.os.family.match(/win/i),
linux: !!agent.os.family.match(/linux/i)

or as @juanpaco suggested, delete your node_modules directory (in your project), update your package.json file to point to "git://github.com/viatropos/tower.git" instead of a specific version of tower, then run npm install from within your project's directory in terminal.