batman✅
batman✅
SSolidJS
Created by batman✅ on 12/27/2024 in #support
Need help debugging this error: Client-only API called on the server side. Run client-only code in
My solid start project works fine in dev mode, but when I try to do vinxi build followed by vinxi start I get the below error:
npm run start

> NODE_ENV=development DEBUG=vinxi:* vinxi start


[6:09:20 am] ERROR Client-only API called on the server side. Run client-only code in onMount, or conditionally run client-only component with <Show>.

at notSup (.output/server/node_modules/solid-js/web/dist/server.js:1136:9)
at .output/server/chunks/nitro/nitro.mjs:7177:17797
at ModuleJob.run (node:internal/modules/esm/module_job:272:25)
at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:552:26)
at async Object.run (node_modules/vinxi/bin/cli.mjs:278:7)
at async runCommand (node_modules/citty/dist/index.mjs:316:16)
at async runCommand (node_modules/citty/dist/index.mjs:307:11)
at async runMain (node_modules/citty/dist/index.mjs:445:7)



[6:09:20 am] ERROR Client-only API called on the server side. Run client-only code in onMount, or conditionally run client-only component with <Show>.
npm run start

> NODE_ENV=development DEBUG=vinxi:* vinxi start


[6:09:20 am] ERROR Client-only API called on the server side. Run client-only code in onMount, or conditionally run client-only component with <Show>.

at notSup (.output/server/node_modules/solid-js/web/dist/server.js:1136:9)
at .output/server/chunks/nitro/nitro.mjs:7177:17797
at ModuleJob.run (node:internal/modules/esm/module_job:272:25)
at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:552:26)
at async Object.run (node_modules/vinxi/bin/cli.mjs:278:7)
at async runCommand (node_modules/citty/dist/index.mjs:316:16)
at async runCommand (node_modules/citty/dist/index.mjs:307:11)
at async runMain (node_modules/citty/dist/index.mjs:445:7)



[6:09:20 am] ERROR Client-only API called on the server side. Run client-only code in onMount, or conditionally run client-only component with <Show>.
I tried addressing the problem by wrapping browser specific API calls with onMount and Show, but I have had no luck so far. My main issue is this error does not tell me which is the offending file and I end up playing the guessing game. Please guide me about how do I resolve this. OS: macOS 15.2 Node: 23.5.0 "@solidjs/start": "^1.0.10", "solid-js": "^1.9.2", "vinxi": "^0.5.1" What have I tried so far? - Tried running vinxi in debug mode. Probably not doing it right. - From the above trace: - .output/server/node_modules/solid-js/web/dist/server.js: 1136:9 this is most likely framework code. .output/server/chunks/nitro/nitro.mjs:7177:17797 : minified server code too
11 replies