es-analysis / plato

JavaScript source code visualization, static analysis, and complexity tool
MIT License
4.56k stars 321 forks source link

Error running with node v6.9.1; Cannot read property 'lastIndexOf' #205

Open ivanwills opened 7 years ago

ivanwills commented 7 years ago

Hi,

When I try running plato with node v6.9.1 (LTS) I get the following error (no errors with node v4.4.4 though)

$ plato --dir .
/home/dev/.nvm/v6.9.1/lib/node_modules/plato/lib/util.js:15
  var lastSlash = files[0].lastIndexOf(path.sep);
                          ^

TypeError: Cannot read property 'lastIndexOf' of undefined
    at Object.exports.findCommonBase (/home/dev/.nvm/v6.9.1/lib/node_modules/plato/lib/util.js:15:27)
    at Object.exports.inspect (/home/dev/.nvm/v6.9.1/lib/node_modules/plato/lib/plato.js:87:29)
    at Object.exports.exec (/home/dev/.nvm/v6.9.1/lib/node_modules/plato/lib/cli.js:53:9)
    at Object.<anonymous> (/home/dev/.nvm/v6.9.1/lib/node_modules/plato/bin/plato:19:5)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)
replete commented 7 years ago

You are missing the input directory. try: plato --dir ./plato-report-output ./

seanohue commented 7 years ago

Perhaps this could be resolved by showing a more user-friendly error message when there is no input directory specified?

tddamith commented 4 years ago

Hi,

When I try running 'sls invoke local -f hello ' I get the following error

Type Error ---------------------------------------------

TypeError: Cannot read property 'lastIndexOf' of undefined at AwsInvokeLocal.invokeLocal (/usr/local/lib/node_modules/serverless/lib/plugins/aws/invokeLocal/index.js:180:45) From previous event: at Object.invoke:local:invoke [as hook] (/usr/local/lib/node_modules/serverless/lib/plugins/aws/invokeLocal/index.js:38:57) at /usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:490:55 From previous event: at PluginManager.invoke (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:490:22) at /usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:525:24 From previous event: at PluginManager.run (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:525:8) at /usr/local/lib/node_modules/serverless/lib/Serverless.js:133:33 From previous event: at Serverless.run (/usr/local/lib/node_modules/serverless/lib/Serverless.js:120:74) at /usr/local/lib/node_modules/serverless/bin/serverless.js:80:26 at processImmediate (internal/timers.js:439:21) at process.topLevelDomainCallback (domain.js:130:23) From previous event: at Object. (/usr/local/lib/node_modules/serverless/bin/serverless.js:80:4) at Module._compile (internal/modules/cjs/loader.js:959:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10) at Module.load (internal/modules/cjs/loader.js:815:32) at Function.Module._load (internal/modules/cjs/loader.js:727:14) at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10) at internal/main/run_main_module.js:17:11