hngngn / shadcn-solid

shadcn/ui, but for Solid.
https://shadcn-solid.com
MIT License
166 stars 11 forks source link

[bug]: CLI won't work please check description #82

Closed thednp closed 1 month ago

thednp commented 1 month ago

Describe the bug

I've tried adding npx shadcn-solid add button an error.

Affected component/components

probably all

How to reproduce

Trying to add shadcn-solid to an existing solid-start project, just using your regular npx shadcn-solid add button won't do.

Codesandbox/StackBlitz link

-

Logs


node:internal/validators:162
    throw new ERR_INVALID_ARG_TYPE(name, 'string', value);
          ^

TypeError [ERR_INVALID_ARG_TYPE]: The "paths[0]" argument must be of type string. Received undefined
    at validateString (node:internal/validators:162:11)
    at resolve (node:path:1101:7)
    at k (file:///home/artae/.npm/_npx/8a8daac7497ab0a9/node_modules/shadcn-solid/dist/index.js:3:209)
    at Mo (file:///home/artae/.npm/_npx/8a8daac7497ab0a9/node_modules/shadcn-solid/dist/index.js:267:4225)
    at file:///home/artae/.npm/_npx/8a8daac7497ab0a9/node_modules/shadcn-solid/dist/index.js:267:4379
    at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
    at async loadESM (node:internal/process/esm_loader:34:7)
    at async handleMainPromise (node:internal/modules/run_main:113:12) {
  code: 'ERR_INVALID_ARG_TYPE'

System Info

VanillaOS Linux

NodeJS v20.10 running in Arch container

Before submitting

hngngn commented 1 month ago

are you using the latest version? because everything work fine to me

thednp commented 1 month ago

I tried both 0.7.2 and 0.7.1.

Can you switch to Node 20 and check again? Also check pnpx shadcn-solid add button.

hngngn commented 1 month ago

i am using node 20 and yes pnpx work just fine, how about components.json, do you update it too? there are some change to the schema recently

thednp commented 1 month ago

I cannot, the init won't go. It throws same error. Where should I put it and what should it contain please?

hngngn commented 1 month ago

is the same, only the content is different

{
  "$schema": "https://shadcn-solid.com/schema.json",
  "tailwind": {
    "config": "tailwind.config.cjs",
    "css": {
      "path": "src/app.css",
      "variable": true
    },
    "color": "slate",
    "prefix": ""
  },
  "alias": {
    "component": "@/components",
    "cn": "@/libs/cn"
  }
}
thednp commented 1 month ago

is the same, only the content is different

Sorry man, I really don't know where.

hngngn commented 1 month ago

in the root of the project

thednp commented 1 month ago

Tried that already won't work. Perhaps it's messing with app.config.ts / vite or tsconfig paths.

hngngn commented 1 month ago

the cli check but not editing anything, does it wok in a fresh solidstart project? im testing on windows btw and everything is working fine

thednp commented 1 month ago

Which schema is correct? This?

"$schema": "https://shadcn-solid.com/schema.json", or "$schema": "https:/shadcn-solid.vercel.app/schema.json" or "$schema": "http://json-schema.org/draft-07/schema#",

hngngn commented 1 month ago

the first one

thednp commented 1 month ago

I just tested on a fresh solid-start bare. The same error.

hngngn commented 1 month ago

im working on a fix rn

thednp commented 1 month ago

HINT: don't do resolve paths like this

resolve(import.meta.somthing, '../package.json')

but do this

resolve(import.meta.somthing, '..', 'package.json')

This is to make sure your paths resolve properly on ALL OS, especially Linux/Mac.