Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Kitsu is not a constructor #103

Closed
ghoshnirmalya opened this issue Jan 21, 2018 · 6 comments
Closed

TypeError: Kitsu is not a constructor #103

ghoshnirmalya opened this issue Jan 21, 2018 · 6 comments
Assignees
Labels

Comments

@ghoshnirmalya
Copy link

I'm getting this error while initializing with the following:

const Kitsu = require('kitsu');

const api = new Kitsu({
  baseURL: "http://localhost:3000/api/v1"
});
@wopian wopian self-assigned this Jan 21, 2018
@wopian
Copy link
Owner

wopian commented Jan 21, 2018

Need some more information to investigate this:

  • kitsu version
  • environment (node/browser) version

@ghoshnirmalya
Copy link
Author

Kitsu: 4.4.0
Browser: Version 63.0.3239.132
Node: 6.10.2

@wopian
Copy link
Owner

wopian commented Jan 22, 2018

I can't seem to replicate this using node 6.10.2. Do you have a repository that has this issue I can test with?

// example/test.js
const Kitsu = require('../lib/kitsu'); // same file as 4.4.0's 'kitsu' require

const api = new Kitsu({
  baseURL: "http://localhost:3000/api/v1"
});

console.log(api)
wopian@WOPCB:/mnt/c/github/kitsu$ nvm exec 6.10.2 node example/test
Running node v6.10.2 (npm v3.10.10)
Kitsu {
  fetch: [Function],
  update: [Function],
  create: [Function],
  camel: [Function: camel],
  resCase: [Function: kebab],
  plural: [Function: pluralize],
  headers: [Object],
  axios: { [Function: wrap] }
}

@wopian
Copy link
Owner

wopian commented Jan 22, 2018

Ah found the issue. The named export for the UMD files were the wrong casing. I.e, while the above code works fine in node itself, in the browser it was failing. If you did the following it would work:

const kitsu = require('kitsu');
const api = new kitsu(...);

I've now fixed this and will be released in 4.4.1 shortly.

@wopian
Copy link
Owner

wopian commented Jan 22, 2018

4.4.1 is now published. Can you verify this issue is fixed with it? 👍

@wopian wopian reopened this Jan 22, 2018
@wopian
Copy link
Owner

wopian commented Jan 27, 2018

Resolved in 4.5.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants