sebinsua / scrape-twitter

🐦 Access Twitter data without an API key. [DEPRECATED]
GNU General Public License v3.0
176 stars 36 forks source link

TypeError: Path must be a string. Received undefined #24

Open willwillems opened 5 years ago

willwillems commented 5 years ago

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 commented 5 years ago

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.

kulor commented 4 years ago

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