gulp-include icon indicating copy to clipboard operation
gulp-include copied to clipboard

TypeError: resultMap.eachMapping is not a function

Open fabien-michel opened this issue 6 years ago • 5 comments

I'm not sure about the exact context, but since upgrading to 2.4.1 (from 2.3.1) we have this error: TypeError: resultMap.eachMapping is not a function

Node 10 Gulp 3 gulp-sourcemaps 2.6.5

To fix the problem we have to force npm package to 2.3.x

fabien-michel avatar Jul 10 '19 13:07 fabien-michel

This is not a solution! Sorcemap will become useless if the galp-include is connected before or after the sorcemap.

ZatolokinPavel avatar Jul 24 '20 12:07 ZatolokinPavel

I have the same problem TypeError: resultMap.eachMapping is not a function

how to solve?

coaperator avatar Nov 01 '20 12:11 coaperator

I have the same problem

TypeError: resultMap.eachMapping is not a function

Need fix it!

6elkir avatar Jan 19 '21 11:01 6elkir

Here's a solution: simply downgrade to 2.3.1.

The problem lies in the fact that [email protected] uses [email protected] while [email protected] uses [email protected] (those are the two versions I tested, anyway). The source-map package uses promises in version 0.7.3 (the SourceMapConsumer returns one) but doesn't in version 0.5.7. gulp-include calls eachMapping on the result of new SourceMapConsumer(...), which clearly breaks when that returns a promise.

vrugtehagel avatar Sep 23 '21 08:09 vrugtehagel

Has anyone figured out how to fix this issue without downgrading? I'm using Gulp 4, so can't simply downgrade gulp-include to version 2.3.1 without even more stuff breaking.

Here's the type error I get whenever I try to compile:

TypeError: resultMap.eachMapping is not a function
    at processInclude (/Users/stephen/Sites/templates/twig-site/node_modules/gulp-include/index.js:206:39)
    at include (/Users/stephen/Sites/templates/twig-site/node_modules/gulp-include/index.js:58:26)
    at wrappedMapper (/Users/stephen/Sites/templates/twig-site/node_modules/map-stream/index.js:83:19)
    at Stream.stream.write (/Users/stephen/Sites/templates/twig-site/node_modules/map-stream/index.js:95:21)
    at DestroyableTransform.ondata (/Users/stephen/Sites/templates/twig-site/node_modules/readable-stream/lib/_stream_readable.js:619:20)
    at DestroyableTransform.emit (node:events:527:28)
    at DestroyableTransform.emit (node:domain:537:15)
    at addChunk (/Users/stephen/Sites/templates/twig-site/node_modules/readable-stream/lib/_stream_readable.js:291:12)
    at readableAddChunk (/Users/stephen/Sites/templates/twig-site/node_modules/readable-stream/lib/_stream_readable.js:278:11)
    at DestroyableTransform.Readable.push (/Users/stephen/Sites/templates/twig-site/node_modules/readable-stream/lib/_stream_readable.js:245:10)
[10:07:08] Finished 'scss' after 819 ms
[10:07:18] The following tasks did not complete: watch, <series>, <parallel>, js
[10:07:18] Did you forget to signal async completion?
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

callaginn avatar Aug 05 '22 15:08 callaginn