Skip to content
New issue

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

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

Already on GitHub? # to your account

Error when running init #310

Open
cideM opened this issue Aug 11, 2023 · 4 comments
Open

Error when running init #310

cideM opened this issue Aug 11, 2023 · 4 comments

Comments

@cideM
Copy link

cideM commented Aug 11, 2023

Environment

$ node --version
v18.16.1
$ npm --version
9.5.1
$ tsc --version
Version 5.1.6

No previous typewriter installation, ran rm -rf node_modules and rg --hidden typewriter. Doing the steps outlined in https://segment.com/docs/protocols/apis-and-extensions/typewriter/#browser-quickstart

Steps

  1. Install analytics.jsusing NPM method, so npm install @segment/analytics-next
$ rg segment/analytics
package.json
20:    "@segment/analytics-next": "^1.53.3",
  1. Once you’ve got analytics.js installed, add Typewriter as a developer dependency in your project: npm install --save-dev typewriter
$ rg typewriter
package.json
47:    "typewriter": "^9.1.0",
  1. If you are a snippet user that uses TypeScript, you should also install the npm library as a dev dependency to get the typescript types. I am not a snippet user, so skipping this
  2. Run npx typewriter init to [...]
  • Ready
  • Copy working token
  • n would not like to store
  • select tracking plan
  • choose analytics as directory
  • language Typescript
  • As SDK choose Web (analytics.js)
  • n for fine tuning
Configuration Summary:
Name           Value
────────────── ─────────────────────────────────────
Tracking Plans *******************
Paths          analytics
Language       TypeScript
SDK            analytics-js
  • y save
? Save these settings? Yes
    TypeError: Cannot read properties of undefined (reading 'method')
$ ls analytics
ls: cannot access 'analytics': No such file or directory
$ uname -a
Darwin *************.local 22.5.0 Darwin Kernel Version 22.5.0: Thu Jun  8 22:22:20 PDT 2023; root:xnu-8796.121.3~7/RELEASE_ARM64_T6000 arm64 arm Darwin

Expectation vs. reality

Expected there to be

  • no error
  • an analytics/ folder

Actual

  • got a typewriter.yml config file but no folder and an error
@cideM cideM changed the title No client created when running init Error when running init Aug 11, 2023
@cideM
Copy link
Author

cideM commented Aug 15, 2023

I also tried these steps on a NixOS system but I get the same error

@cideM
Copy link
Author

cideM commented Aug 15, 2023

It seems that init simply no longer creates a client. Either the documentation or the code needs to be updated. I don't see anything about generating a client in the command

The error appears to come from the initCommand call

@Jorundur
Copy link

Jorundur commented Sep 21, 2023

Having the same issue. Can someone from Segment look into this? It's been over a month now.

EDIT: I just ran the command again and this time it worked. The only difference now was that since I'm using pnpm in my project I did pnpm dlx typewriter init instead of npx typewriter init and that worked. Maybe that was necessary!

@cideM
Copy link
Author

cideM commented Jun 7, 2024

This is still an issue, regardless of whether you use npx or you install the required packages manually.

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

No branches or pull requests

2 participants