'Bitbucket is not a constructor using bitbucketjs

Im using this library to manage bitbucket api from nodejs.

I have received a message about a deprecated endpoint so I saw that library have released a new version (2).

So, I have uninstall bitbucket dependency and installed again to version 2.7.0

But now, Im getting an error like this:

let bitbucketAPI = new Bitbucket()
               ^

TypeError: Bitbucket is not a constructor

This is the change in package.json

-    "bitbucket": "^1.15.1",
+    "bitbucket": "^2.7.0",

And this is my code:

let Bitbucket = require('bitbucket')
let bitbucketAPI = new Bitbucket()

I have deleted package-lock.json, node_modules/bitbucket folder, update dependencies with npm update but anything works..

Any idea?



Solution 1:[1]

Linked docs destructure Bitbucket:

const { Bitbucket } = require('bitbucket')

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1