dvdciri / daggraph

Dagger dependency graph generator for Android Developers
MIT License
1.15k stars 58 forks source link

TypeError on DaggerAnalyzer - includes is not a function #28

Closed julioz closed 6 years ago

julioz commented 6 years ago

Description

Not sure if this is an environment issue and daggraph depends on a specific version of other software, but I can't run it from a fresh install. The stack-trace follows:

$ daggraph
Analyzing dagger components and modules..
/usr/local/lib/node_modules/daggraph/src/dagger/DaggerAnalyzer.js:109
            if (!injectionPathMap[depIdentifier].includes(path)){
                                                 ^

TypeError: injectionPathMap[depIdentifier].includes is not a function
    at FileSniffer.fileSniffer.on (/usr/local/lib/node_modules/daggraph/src/dagger/DaggerAnalyzer.js:109:50)
    at emitTwo (events.js:106:13)
    at FileSniffer.emit (events.js:194:7)
    at LineStream.<anonymous> (/usr/local/lib/node_modules/daggraph/node_modules/filesniffer/lib/filesniffer.js:194:20)
    at emitNone (events.js:86:13)
    at LineStream.emit (events.js:188:7)
    at emitReadable_ (_stream_readable.js:434:10)
    at emitReadable (_stream_readable.js:428:7)
    at readableAddChunk (_stream_readable.js:189:13)
    at LineStream.Readable.push (_stream_readable.js:136:10)
    at LineStream.Transform.push (_stream_transform.js:128:32)
    at LineStream._pushBuffer (/usr/local/lib/node_modules/daggraph/node_modules/byline/lib/byline.js:125:17)
    at LineStream._transform (/usr/local/lib/node_modules/daggraph/node_modules/byline/lib/byline.js:116:8)
    at LineStream.Transform._read (_stream_transform.js:167:10)
    at LineStream.Transform._write (_stream_transform.js:155:12)
    at doWrite (_stream_writable.js:329:12)
    at writeOrBuffer (_stream_writable.js:315:5)

Steps to reproduce

1 - Installed daggraph as suggested (npm install -g daggraph) 2 - Run daggraph

Expected behaviour

Generate graph.

Screenshot

N/A

reid112 commented 6 years ago

I also ran into this issue. I was able to run daggraph on one of my apps fine and it works great! However, when I try to run daggraph on my other app (much much bigger app), I get this same error

dvdciri commented 6 years ago

Following this reddit post https://www.reddit.com/r/learnjavascript/comments/4mtpam/nodejs_arrayincludes_is_not_a_function_error/ try to check your node version and update to at least Node 6. If it doesn't work please let me know.

FrancoisBlavoet commented 6 years ago

@dvdciri I have just checked node's version (9.4.0) and updated daggraph for good measure, I still get the same exception

dvdciri commented 6 years ago

Do you have an android project on github on which you can reproduce this issue so i can try to reproduce it and fix it locally?

FrancoisBlavoet commented 6 years ago

Unfortunately I can't share my employer's project.
I will see if I can reproduce the same issue on one of my personal projects.

dvdciri commented 6 years ago

Please, if you can help me reproduce this reopen the issue and I'll fix it. Otherwise closing it for now

NikolaDespotoski commented 4 years ago

I'm experiencing this: Version: npm@6.13.7

Analyzing dagger components and modules..
C:\Users\HiddenUser\AppData\Roaming\npm\node_modules\daggraph\bin\dagger\DaggerAnalyzer.js:143
        if (!injectionPathMap[depIdentifier].includes(path)) {
                                             ^

TypeError: injectionPathMap[depIdentifier].includes is not a function
    at FileSniffer.<anonymous> (C:\Users\HiddenUser\AppData\Roaming\npm\node_modules\daggraph\bin\dagger\DaggerAnalyzer.js:143:46)
    at FileSniffer.emit (events.js:321:20)
    at LineStream.<anonymous> (C:\Users\HiddenUser\AppData\Roaming\npm\node_modules\daggraph\node_modules\filesniffer\dist\src\filesniffer.js:136:26)
    at LineStream.emit (events.js:321:20)
    at emitReadable_ (_stream_readable.js:558:12)
    at processTicksAndRejections (internal/process/task_queues.js:83:21)