ModClean / modclean

Remove unwanted files and directories from your node_modules folder
MIT License
400 stars 15 forks source link

Maximum call stack size exceeded #9

Closed Rush closed 7 years ago

Rush commented 8 years ago
/c/v/w/frontend master ❯ modclean --test                                                                                                                            ✭ ✱ ◼

MODCLEAN v1.2.7

RUNNING IN TEST MODE
When running in test mode, files will not be deleted from the file system.

> Found 2927 files/folders to remove

Cleanup Progress [||||||||||||---------------------------] 32% (934/2927)/home/rush/.nvm/versions/node/v4.4.2/lib/node_modules/modclean/node_modules/colors/lib/extendStringPrototype.js:70
      'indexOf', 'lastIndexof', 'length', 'localeCompare', 'match', 'replace', 'search', 'slice', 'split', 'substring',
                                                              ^

RangeError: Maximum call stack size exceeded
    at String.valueOf (native)
    at Object.stylize (/home/rush/.nvm/versions/node/v4.4.2/lib/node_modules/modclean/node_modules/colors/lib/colors.js:55:33)
    at String.magenta (/home/rush/.nvm/versions/node/v4.4.2/lib/node_modules/modclean/node_modules/colors/lib/extendStringPrototype.js:58:21)
    at log (/home/rush/.nvm/versions/node/v4.4.2/lib/node_modules/modclean/bin/modclean.js:230:29)
    at ModClean.<anonymous> (/home/rush/.nvm/versions/node/v4.4.2/lib/node_modules/modclean/bin/modclean.js:166:13)
    at emitOne (events.js:77:13)
    at ModClean.emit (events.js:169:7)
    at ModClean._deleteFile (/home/rush/.nvm/versions/node/v4.4.2/lib/node_modules/modclean/index.js:239:14)
    at /home/rush/.nvm/versions/node/v4.4.2/lib/node_modules/modclean/index.js:210:43
    at ModCleanCLI.options.process (/home/rush/.nvm/versions/node/v4.4.2/lib/node_modules/modclean/bin/modclean.js:96:42)
KyleRoss commented 7 years ago

Not the best fix, but I set it to not parse the log message unless it needs to with verbose mode on. This should fix this particular stack overflow error. I need to sit down and refactor the CLI to improve performance and completely prevent this issue in the future. This fix has been released in version 1.3.0. Thanks for reporting!