scrape-twitter icon indicating copy to clipboard operation
scrape-twitter copied to clipboard

TypeError: Path must be a string. Received undefined

Open willwillems opened this issue 6 years ago • 2 comments

I'm getting an error when importing scrape-twitter with require('scrape-twitter') which is being thrown by the expandHome function in the cli-utils.js file.

Trace:

TypeError: Path must be a string. Received undefined
    at assertPath (path.js:28:11)
    at join (path.js:1236:7)
    at expandHomeDir (/Users/Admin/Desktop/100x365/functions/node_modules/expand-home-dir/index.js:10:10)
    at Object.<anonymous> (/Users/Admin/Desktop/100x365/functions/node_modules/scrape-twitter/dist/lib/cli-utils.js:6:29)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)

willwillems avatar Dec 02 '18 16:12 willwillems

I ended up fixing this by commenting out the line where the expandHome function was called and the line further in the file where the variable that is created in that line is console logged.

willwillems avatar Dec 02 '18 16:12 willwillems

I hit this in an AWS Lambda instance. My workaround was to set the env HOME to /tmp. Warning; is a bandaid over the problem. Source of the problem lies in https://github.com/sebinsua/scrape-twitter/blob/8ccdb42455145e99af8c80a9b91e62535155a696/src/lib/cli-utils.js#L4

kulor avatar Feb 16 '20 08:02 kulor