dougmartin / gulp-trimlines

Gulp plugin to trim leading and/or trailing spaces per line
http://dougmart.in/projects/gulp-trimlines
MIT License
4 stars 0 forks source link

TypeError: Cannot read property 'toString' of null #1

Closed benjaminprojas closed 7 years ago

benjaminprojas commented 7 years ago

While parsing through a ton of files the error above was triggered. Here are the full contents of the error:

/Users/benjamin/Work/Awesome Motive/Optin Monster/git/optin-monster-app-kinship/node_modules/gulp-trimlines/index.js:31
      file.contents = new Buffer(file.contents.toString(options.encoding).replace(regex, ""));
                                              ^

TypeError: Cannot read property 'toString' of null
    at DestroyableTransform._transform (/Users/benjamin/Work/Awesome Motive/Optin Monster/git/optin-monster-app-kinship/node_modules/gulp-trimlines/index.js:31:47)
    at DestroyableTransform.Transform._read (/Users/benjamin/Work/Awesome Motive/Optin Monster/git/optin-monster-app-kinship/node_modules/gulp-trimlines/node_modules/readable-stream/lib/_stream_transform.js:184:10)
    at DestroyableTransform.Transform._write (/Users/benjamin/Work/Awesome Motive/Optin Monster/git/optin-monster-app-kinship/node_modules/gulp-trimlines/node_modules/readable-stream/lib/_stream_transform.js:172:12)
    at doWrite (/Users/benjamin/Work/Awesome Motive/Optin Monster/git/optin-monster-app-kinship/node_modules/gulp-trimlines/node_modules/readable-stream/lib/_stream_writable.js:237:10)
    at writeOrBuffer (/Users/benjamin/Work/Awesome Motive/Optin Monster/git/optin-monster-app-kinship/node_modules/gulp-trimlines/node_modules/readable-stream/lib/_stream_writable.js:227:5)
    at DestroyableTransform.Writable.write (/Users/benjamin/Work/Awesome Motive/Optin Monster/git/optin-monster-app-kinship/node_modules/gulp-trimlines/node_modules/readable-stream/lib/_stream_writable.js:194:11)
    at DestroyableTransform.ondata (/Users/benjamin/Work/Awesome Motive/Optin Monster/git/optin-monster-app-kinship/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:546:20)
    at emitOne (events.js:96:13)
    at DestroyableTransform.emit (events.js:188:7)
    at readableAddChunk (/Users/benjamin/Work/Awesome Motive/Optin Monster/git/optin-monster-app-kinship/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:217:18)
dougmartin commented 7 years ago

@benjaminprojas I just fixed this in https://github.com/dougmartin/gulp-trimlines/pull/2 and published the change to npm

benjaminprojas commented 7 years ago

Thanks! Looks like it took care of it. I'm now getting another error though... I'll write up a new issue.