npm / fstream

Advanced FS Streaming for Node
ISC License
208 stars 43 forks source link

Uncaught TypeError: Object [object Object] has no method 'on' #46

Closed kellyselden closed 9 years ago

kellyselden commented 9 years ago

I first started seeing this yesterday on PR's to ember-cli. They all have this error:

Acceptance: ember install installs addons via npm and runs generators:
     Uncaught TypeError: Object [object Object] has no method 'on'
      at FileReader._getStream (node_modules/bower/node_modules/fstream/lib/file-reader.js:41:10)
      at FileReader._read (node_modules/bower/node_modules/fstream/lib/file-reader.js:99:17)
      at go (node_modules/bower/node_modules/fstream/lib/reader.js:214:21)
      at go (node_modules/bower/node_modules/fstream/lib/reader.js:217:7)
      at go (node_modules/bower/node_modules/fstream/lib/reader.js:217:7)
      at go (node_modules/bower/node_modules/fstream/lib/reader.js:217:7)
      at statCb (node_modules/bower/node_modules/fstream/lib/reader.js:218:7)
      at Object.oncomplete (fs.js:108:15)

Perhaps it coincides with your recent release? Maybe an issue with the graceful-fs major version bump?

stefanpenner commented 9 years ago

Turns out, this appears is the result of TWO libs both patching FS. GracefulFS and https://github.com/stefanpenner/fs-monitor-stack

Quick fix is to disable fs-monitor-stack unless its required (should have been the case anyways)

Relevant commit

othiym23 commented 9 years ago

Just so everyone knows, we're in the process of upgrading graceful-fs everywhere within npm, because future versions of Node (Node 5+) are probably going to use the internal bindings in an incompatible way that will break code trying to monkeypatch the fs code the old way (i.e. by using process.binding()). See also nodejs/node#2714 for one example of how this change might be made, but there are others.

I'm going to close this as not an issue in fstream, and in any case one that is addressed now by having switched to graceful-fs@4 in the latest version of fstream.

stefanpenner commented 9 years ago

@othiym23 sounds good. I'm still waiting on CI, but I am fairly confident it was the double monkey patching of FS modules that caused grief. Ultimately our patching was only to instrument for performance testing, and was only accidentally left always enabled.