TypeError: pubnub_1.default is not a constructor
See original GitHub issueI’m not sure this issue is related to pubnub or ts-node, but when I use pubnub with ts-node together, it will throw out the following error:
TypeError: pubnub_1.default is not a constructor
My code is:
import Pubnub from "pubnub"
const pubnub = new Pubnub({
subscribeKey: "sub-c-52a9ab50-291b-11e5-baaa-0619f8945a4f"
})
And my tsconfig.json is:
{
"compilerOptions": {
"strict": true,
"lib": ["es6"],
"typeRoots": [
"./node_modules/@types/",
"./src/@types/"
]
}
}
I’ve already installed types for pubnub,
npm install pubnub --save
npm install @types/pubnub --save-dev
I guess I need to change some configurations in tsconfig.json, any ideas?
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Error: *.default is not a constructor - Stack Overflow
I get the following error, when testing some javascript code, transpiled from a typescript file. Here is the error: Error: _mapAction2.default ...
Read more >TypeError: web3_1.default is not a constructor
I'm trying to convert a DApp that uses web3.js from JavaScript to TypeScript, but I have encountered a bunch of runtime errors. I'm...
Read more >Hi, to fix this `o.default is not a constructor`, you need to adjust ...
Hi, to fix this `o.default is not a constructor`, you need to adjust your import statement, from: import Cookies from 'universal-cookie';.
Read more >TypeError: _gauge2.default is not a constructor - Laracasts
I'm trying to wrap this gauge http://bernii.github.io/gauge.js/ in a Vue component, but Vue gives me the error: TypeError: _gauge2.default is not a ......
Read more >colyseus_js__WEBPACK_IMPO...
BattleScreen.js:16 Uncaught TypeError: colyseus_js__WEBPACK_IMPORTED_MODULE_1___default.a is not a constructor. any thoughts? Reply Quote.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

The correct import is
import pubnub = require('pubnub')."esModuleInterop": true,