StockAlertBot: dotenv.config is not a function

c:\StockAlertBot>npm start

> stock-alert-bot@2.0.0 start c:\StockAlertBot
> node main.js

file:///c:/StockAlertBot/utils/config.js:2
dotenv.config();
       ^

TypeError: dotenv.config is not a function
    at file:///c:/StockAlertBot/utils/config.js:2:8
    at ModuleJob.run (internal/modules/esm/module_job.js:110:37)
    at async Loader.import (internal/modules/esm/loader.js:179:24)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! stock-alert-bot@2.0.0 start: `node main.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the stock-alert-bot@2.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\James\AppData\Roaming\npm-cache\_logs\2021-01-26T23_45_16_239Z-debug.log

Any fix?

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (4 by maintainers)

Most upvoted comments

Issue was resolved. Needed to reinstall everything from start, including windows 10

I had the same problem. Just update node to the latest version. It’ll work 😃