emgeee / gulp-natural-sort

Sort stream by path name using a natural sort
MIT License
12 stars 1 forks source link

String.naturalCompare is not a function #1

Closed dielduarte closed 9 years ago

dielduarte commented 9 years ago

so, I have this task:

gulp.task('inject-all', function () {

return gulp.src('app/index.html') .pipe( $.inject( gulp.src('.tmp/*/.js') .pipe($.plumber()) .pipe($.naturalSort()) .pipe($.angularFilesort()), { ignorePath: '../.tmp', relative: true, })) .pipe( $.inject( gulp.src('.tmp//styles/.css', {read: false}), { ignorePath: '../.tmp', relative: true, })) .pipe(gulp.dest('app')); });

when gulp run .pipe($.naturalSort()), i have this error in console:

TypeError: String.naturalCompare is not a function at /Users/diel/Documents/localhost/public/teste/node_modules/gulp-natural-sort/index.js:16:21 at Array.sort (native) at Stream.onEnd (/Users/diel/Documents/localhost/public/teste/node_modules/gulp-natural-sort/index.js:15:11) at _end (/Users/diel/Documents/localhost/public/teste/node_modules/gulp-natural-sort/node_modules/through/index.js:65:9) at Stream.stream.end (/Users/diel/Documents/localhost/public/teste/node_modules/gulp-natural-sort/node_modules/through/index.js:74:5) at DestroyableTransform.onend (/Users/diel/Documents/localhost/public/teste/node_modules/gulp-plumber/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:523:10) at DestroyableTransform.g (events.js:260:16) at emitNone (events.js:72:20) at DestroyableTransform.emit (events.js:166:7) at /Users/diel/Documents/localhost/public/teste/node_modules/gulp-plumber/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:965:16 at doNTCallback0 (node.js:407:9) at process._tickCallback (node.js:336:13)

you can help me? i don't understand because Yesterday this error did not exist, but today this error occurred even the task being identical.

thanks.

mcgrews3 commented 9 years ago

Hello - I just added a pull request to fix this issue.

https://github.com/emgeee/gulp-natural-sort/pull/2

Just waiting on acceptance of the pull request...

Thanks.

emgeee commented 9 years ago

I went ahead and merged @mcgrews3 PR. @dielduarte can you confirm this fixes your issue?

dielduarte commented 9 years ago

yes, this merge resolves my problem. thanks @mcgrews3 and @emgeee

emgeee commented 9 years ago

Great!

jmartin4563 commented 9 years ago

Just curious if this has been published to npm as of time of ticket closing? We're seeing the same behavior currently.

/var/spool/ecbuild/bamboo-agent-home/xml-data/build-dir/CENG-WU183-RUNWEFT/cloud-webui/node_modules/gulp-natural-sort/index.js:16
      return String.naturalCompare(a.relative.toLowerCase(), b.relative.toLowe
                    ^
TypeError: Object function String() { [native code] } has no method 'naturalCompare'
dielduarte commented 9 years ago

@jmartin4563 you update for 0.1.1?

jmartin4563 commented 9 years ago

i just did, worked like a charm, thanks for the quick turnaround!! :+1: