PostHog / posthog-node

Official PostHog Node library
MIT License
21 stars 19 forks source link

error: uncaughtException: Cannot find module './feature-flags' #34

Closed anuraagbarde closed 3 years ago

anuraagbarde commented 3 years ago

When I do, yarn add posthog-node inside the node_modules/posthog-node the directory structure is like this, node_modules clis.js event-validation.js index.d.ts index.js LICENSE package.json README.md

Inside index.js const { FeatureFlagsPoller } = require('./feature-flags')

there is no './feature-flags' in the folder node_modules/posthog-node/

But here in this Github repo, I see it is there. How to fix this?

yakkomajuri commented 3 years ago

Hey @anuraagbarde! What version of posthog-node are you on?

anuraagbarde commented 3 years ago

The posthog-node version would be 1.1.0

anuraagbarde commented 3 years ago

Also, I manually had to copy the feature-flags.js file into the /node_modules/posthog-node/ folder for it to work.

anuraagbarde commented 3 years ago

https://github.com/PostHog/posthog-node/runs/2774288891?check_suite_focus=true

npm notice === Tarball Contents === npm notice 1.1kB LICENSE
npm notice 1.7kB cli.js
npm notice 2.3kB event-validation.js npm notice 9.5kB index.js
npm notice 1.6kB package.json
npm notice 573B README.md
npm notice 4.2kB index.d.ts

There is no feature-flags.js

yakkomajuri commented 3 years ago

Indeed, I downloaded the tarball from GitHub and that was fine, but npm version didn't

Let me try to publish a patch version

yakkomajuri commented 3 years ago

cc @Twixes for the workflow

yakkomajuri commented 3 years ago

Solved, please update to v1.1.2.

The issue was the files array in package.json so @Twixes you can ignore my comment above.