mkreiser / ESPN-Fantasy-Football-API

Connect to ESPN's fantasy football API via this JS API client for web and NodeJS. Available as an npm package.
http://espn-fantasy-football-api.s3-website.us-east-2.amazonaws.com/
GNU Lesser General Public License v3.0
296 stars 74 forks source link

How to fix: TypeError: Client is not a constructor #236

Open Koch-Abrams opened 9 months ago

Koch-Abrams commented 9 months ago

Node-beginner here. I can't find a fix for the error message above, when declaring a new myClient variable.

Error message:

file:///Users/christopher.koch/dev/node_test/test.js:3
const myClient = new Client({ leagueId: 432132 });
                 ^

TypeError: Client is not a constructor
    at file:///Users/christopher.koch/dev/node_test/test.js:3:18
    at ModuleJob.run (node:internal/modules/esm/module_job:217:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)
    at async loadESM (node:internal/process/esm_loader:34:7)
    at async handleMainPromise (node:internal/modules/run_main:66:12)

Node.js v20.8.0

Can someone tell me what i'm doing wrong?

mkreiser commented 9 months ago

This likely means you are importing the Client class incorrectly. Can you post more of the test.js file?