nicoalbanese / kirimase

Build full-stack Next.js apps, incredibly fast
https://kirimase.dev
MIT License
2.39k stars 107 forks source link

Error during Kirimase initialization with pnpm: 'TypeError [ERR_INVALID_ARG_TYPE]' #122

Closed Lucas-Yon closed 5 months ago

Lucas-Yon commented 5 months ago

Config File

{
  "hasSrc": true,
  "packages": [
    "shadcn-ui",
    "drizzle"
  ],
  "preferredPackageManager": "pnpm",
  "t3": false,
  "alias": "@",
  "rootPath": "src/",
  "componentLib": "shadcn-ui",
  "orm": "drizzle"
}

Describe the bug When using kirimase init in a nextjs app generated using:

pnpm create next-app

Kirimase seems to skip some steps :

✔ Kirimase initialized!                                                   5:55:05 PM
ℹ You can now add packages.                                               5:55:05 PM
◐ Checking project for existing packages...                                5:55:05 PM
✔ Successfully searched project and found no additional packages.         5:55:05 PM
? Select a component library to use: Shadcn UI (with next-themes)
? Select an ORM to use: Drizzle
? Select an authentication package to use: Auth.js (NextAuth)
? Select a provider to add
? Select any miscellaneous packages to add: TRPC

Then give the following error after choosing TRPC :

⠋ node:internal/fs/utils:916
    throw new ERR_INVALID_ARG_TYPE(
          ^

TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received undefined
    at Object.writeFileSync (node:fs:2335:5)
    at createFile (file:///C:/Users/lukin/AppData/Local/pnpm/global/5/.pnpm/kirimase@0.0.45/node_modules/kirimase/dist/utils.js:15:8)
    at addNextAuth (file:///C:/Users/lukin/AppData/Local/pnpm/global/5/.pnpm/kirimase@0.0.45/node_modules/kirimase/dist/commands/add/auth/next-auth/index.js:33:13)
    at addPackage (file:///C:/Users/lukin/AppData/Local/pnpm/global/5/.pnpm/kirimase@0.0.45/node_modules/kirimase/dist/commands/add/index.js:130:23)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: 'ERR_INVALID_ARG_TYPE'
}

Node.js v20.10.0

To reproduce

  1. Generate a Next.js app using pnpm.
  2. Use kirimase init

Expected behavior Kirimase should prompt the user which DB type/driver use.

Screenshots image

Desktop:

nicoalbanese commented 5 months ago

Hey! sorry you've experienced this. I unfortunately haven't been able to recreate. I suspect it may be a package manager cache issue. Would you mind trying to either clear the cache [1] or try with a different package manager (making sure you're running it with @latest flag?

[1] https://github.com/orgs/pnpm/discussions/4413

nicoalbanese commented 5 months ago

I figured it out! Did your project have a db driver in it's name (like postgres, pg, mysql etc.)? My initial package check script was checking the entire package.json rather than just the dependencies. I just ran into the problem while I was testing some postgres features. Hope this sorts it all out!