drewzboto / grunt-connect-proxy

Grunt Connect support for proxying API calls during development
MIT License
424 stars 122 forks source link

TypeError: Cannot read property 'prototype' of undefined #97

Closed alarrosa14 closed 9 years ago

alarrosa14 commented 9 years ago

I can't load grunt-connect-proxy. After installing it I get the following error after executing grunt serve:

Loading "connect_proxy.js" tasks...ERROR
>> TypeError: Cannot read property 'prototype' of undefined

Grunt version: 0.4.5

thedug commented 9 years ago

Same here. My build is blowing up.

Looks like the new version of eventemitter3 (1.0.1) is causing the error

Looking back through our build server this version passed..

grunt-connect-proxy@0.1.11 node_modules/grunt-connect-proxy └── http-proxy@1.1.6 (eventemitter3@0.1.6)

This one failed

grunt-connect-proxy@0.1.11 node_modules/grunt-connect-proxy └── http-proxy@1.1.6 (eventemitter3@1.0.1)

thedug commented 9 years ago

We are going to use npm shrinkwrap to force the older version of eventemitter3

phobetron commented 9 years ago

Here's the (closed) bug ticket for eventemitter3 https://github.com/primus/eventemitter3/issues/29

Looks like there are breaking changes that everyone is expected to patch against. Looks like grunt-connect-proxy may also be using anolder version of http_proxy?

lostthetrail commented 9 years ago

I am also seeing this issue.

sjerman commented 9 years ago

shrinkwrapping does fix the issue...

jaan commented 9 years ago

same here:

$ grunt server --verbose

Loading "Gruntfile.js" tasks...ERROR
>> TypeError: Cannot read property 'prototype' of undefined
>>     at Object.exports.inherits (util.js:634:43)
>>     at Object.<anonymous> (/ProjectPath/node_modules/grunt-connect-proxy/node_modules/http-proxy/lib/http-proxy/index.js:106:17)
>>     at Module._compile (module.js:460:26)
>>     at Object.Module._extensions..js (module.js:478:10)
>>     at Module.load (module.js:355:32)
>>     at Function.Module._load (module.js:310:12)
>>     at Module.require (module.js:365:17)
>>     at require (module.js:384:17)
>>     at Object.<anonymous> (/ProjectPath/node_modules/grunt-connect-proxy/node_modules/http-proxy/lib/http-proxy.js:4:17)
>>     at Module._compile (module.js:460:26)
phobetron commented 9 years ago

As a simple workaround, I pinned the eventemitter3 version in my package.json file.

...
"eventemitter3": "^0.1.6",
...
emiller commented 9 years ago

We also hit this issue. http-proxy released a new version ~9 hours ago which may be the likely cause. If @phobetron's simple fix works, then there is a good chance that the problematic commit in the new version is:

https://github.com/nodejitsu/node-http-proxy/commit/18c77cafc7d5479502cf5c4d2b663d8f85cfd6d4#diff-8bcb067b974b0e74fe86cdb07748315e

Edit: noticed eventemitter3 also had a release 11 hours ago (2 hours before http-proxy) in which this went out:

https://github.com/primus/eventemitter3/commit/43211e9a9050887530421e8e2d8b9e1aa2506cc4#diff-168726dbe96b3ce427e7fedce31bb0bc

Looks like just bad timing?

thedug commented 9 years ago

@phobetron How can you peg it in your package.json to fix this? This is a transitive dependency so it will install both versions right?

thedug commented 9 years ago

shrinkwrap fails for me on my build server. arg!

linux-x64-node-0.10 exists; testing Binary is fine; exiting npm ERR! cb() never called! npm ERR! not ok code 0

phobetron commented 9 years ago

All I know is, it worked for me. I placed that line among my dev dependencies.

thedug commented 9 years ago

Strange that did work. How does a project dependency impact a dependency from another module since these are downloaded into sub dirs.

esseti commented 9 years ago

have a look at this https://github.com/drewzboto/grunt-connect-proxy/issues/95

ruiaraujo commented 9 years ago

This issue has been solved in #96.