elidoran / cosmos-browserify

Browserify npm modules for client side in Meteor packages
MIT License
78 stars 12 forks source link

Error when changing files #4

Closed arunoda closed 9 years ago

arunoda commented 9 years ago

This happens when I'm changing locally symlinked package reside in the packages directory. I can also say this is sometimes random.

The package I'm symlinking is the flow-router with your PR for this package integration.

=> Modified -- restarting.
=> Meteor server restarted
=> Errors prevented startup:

   While building package meteorhacks:flow-router:
   packages/cosmosBrowserify/plugin/browserify.coffee:12:16: undefined is not a function (compiling browserify.js) (at Package)

=> Your application has errors. Waiting for file change

Have a look on this.

elidoran commented 9 years ago

It seems this is an error coming from browserify. There are a lot of google results with persons receiving this error from browserify.

I'll look at causing errors in the browserify.js file and using CompileStep#error to report the error.

arunoda commented 9 years ago

Okay. Is there anyway we can get around with this rather then throwing the error message?

elidoran commented 9 years ago

I think what we're seeing is a thrown error from browserify and I'm not catching it and reporting it with CompileStep#error like I'm supposed to.

I'm wondering if we'll see more helpful information when it's caught and handled instead of allowing it to make it out into the build process.

Another option is to consider the error info is correct and the problem really is on line 12 of my browserify.coffee. It says undefined is not a function and the function on that line is stream.PassThrough(). I don't see why that would be undefined.

I'm trying to setup a project with this error so I can reproduce it. I made a project using a symlink to my edited flow-router. But it hasn't errored yet.

Does it error after it has restarted the server multiple times, as if there's a memory leak building up until it can't run correctly? Does it run properly after you restart the Meteor app?

arunoda commented 9 years ago

Yes it get fixed once I restart the project. This happens when I'm changing the window.page stuff.

What's the memory leak thing? I didn't follow that.

elidoran commented 9 years ago

Sometimes I get an error on a DigitalOcean hosted VM running Meteor because it has too little memory and Meteor's tools avoid streaming and instead pull data into memory, like my browserify.coffee must do. So, I'm wondering if somehow the streams I'm using are causing memory to be used up and not released so Meteor eventually runs into trouble and has to be restarted. If things work okay after you restart Meteor then it seems like we have a memory problem.

If I put errors in browserify.js then they're reported in the browser console, not during the build process.

If I intentionally misspell the function on line 12, new stream.PassThrough(), then I get an error which looks very similar to the one you did. I don't see how stream.PassThrough would be undefined some times.

=> Client modified -- refreshing (x2)
=> Errors prevented startup:                  

   While building package meteorhacks:flow-router:
   <runJavaScript-96>:37:14: undefined is not a function (compiling browserify.js) (at Package)

=> Your application has errors. Waiting for file change.

I assume the cosmos:browserify version loaded in your app is 0.1.3? The initial version has a bug which would cause stream to be overwritten with a new value which doesn't have a PassThrough property.

arunoda commented 9 years ago

Okay. Let me check the version. Something meteor does not loads the latest version. On 2015 මැයි 6, බදාදා at පෙ.ව. 8.55 Eli Doran notifications@github.com wrote:

Sometimes I get an error on a DigitalOcean hosted VM running Meteor because it has too little memory and Meteor's tools avoid streaming and instead pull data into memory, like my browserify.coffee must do. So, I'm wondering if somehow the streams I'm using are causing memory to be used up and not released so Meteor eventually runs into trouble and has to be restarted. If things work okay after you restart Meteor then it seems like we have a memory problem.

If I put errors in browserify.js then they're reported in the browser console, not during the build process.

If I intentionally misspell the function on line 12, new stream.PassThrough(), then I get an error which looks very similar to the one you did. I don't see how stream.PassThrough would be undefined some times.

=> Client modified -- refreshing (x2) => Errors prevented startup:

While building package meteorhacks:flow-router:

:37:14: undefined is not a function (compiling browserify.js) (at Package) => Your application has errors. Waiting for file change. I assume the cosmos:browserify version loaded in your app is 0.1.3? The initial version has a bug which would cause stream to be overwritten with a new value which doesn't have a PassThrough property. — Reply to this email directly or view it on GitHub https://github.com/elidoran/cosmos-browserify/issues/4#issuecomment-99306727 .
arunoda commented 9 years ago

I think I was using a older version 0.1.0. I don't know why Meteor didn't fetch the latest version. (May be we need to update the flow-routes's version to 0.1.3 Now I don't get this issue.

elidoran commented 9 years ago

I added the specific version to the PR. Would you like me to squash the commits into one? I had intended for the PR to be a single commit but these recent changes have built them up.

I noticed meteor doesn't grab the latest version as well. I should have thought of that sooner. I also added the specific version to my documentation examples. It's very unhelpful I had that bug in version 0.1.0 as it seems to come back and bite me.

I added a test and reformatted the source code. When I get a few more tests in there and get some more feedback I'll bump the version into the 1.x realm.

arunoda commented 9 years ago

Okay. Great. Shall I close this issue? Do we have something work here.

elidoran commented 9 years ago

I believe using 0.1.3 fixes your issue so this one can be closed.