Closed 03-01-0v0 closed 2 years ago
Try to import { PostHogGlobal } instead of PostHog and also initialize the client by PostHogGlobal, too. It worked for me!
Sorry about that, will update the docs, we've also updated the library to work with import { PostHog }
.
Hi, I am getting the following error with posthog-node Here is my package.json file : { "name": "test", "version": "1.0.0", "description": "", "main": "index.js", "type": "module", "scripts": { "start": "node src/index.js", "dev": "nodemon src/index.js" }, "keywords": [], "author": "", "license": "ISC", "dependencies": { "express": "^4.18.1", "nodemon": "^2.0.19", "posthog-node": "^2.0.1" } } Code with posthog in index.js . file : import PostHog from 'posthog-node'
const client = new PostHog( 'phc_UbdQ93ylhwFK2K2loRAyZrKOKtdNzhyryieuteir', { host: 'https://app.posthog.com' } // You can omit this line if using PostHog Cloud )
client.shutdown() --> there will be an error message PostHog is not a constructor. Pls help me.