-
Notifications
You must be signed in to change notification settings - Fork 375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug?]: Error: Client-only API called on the server side. When using npm run dev on a brand new solidstart project #1679
Comments
same issue |
I had the same issue as well. Using pnpm create solid@latest, pnpm install, pnpm dev. Didn't give the same issues. |
Same issue. I'm running npm version Edit: using |
Same Problem. :( ... checked some (not all!) package-versions and they all seem to be the same as in my working projects. Running on MacOS. |
Also observed with npm on macos, but works with pnpm |
❯ pnpm -v
9.11.0
❯ npm -v
10.8.3
❯ node -v
v22.9.0
❯ uname
Linux An error occurred in pnpm workspace Works fine in pnpm (not workspace) or npm |
Same problem here. For a new project I copied node_modules folder from working project and it works fine, but I hope they will fix it soon. |
I was able to reproduce this by updating to Vite 6 on the main project. So it is some sort of mismatch on versioning I think. I do use pnpm to be fair so I hadn't noticed it on any of the projects or examples until I made the vite 6 change. We also happen to be working on updating Vinxi and Vite versions so there should be a release soon that has all the matching versions again. I'm not sure how wrong versions are getting included. Something to do with package resolution and locking I guess but I'm gathering it has to do with sub dependencies depending on different versions of packages. |
Same issue on every
At this stage I had the
Everything works with the old libs lock references I did perform a diff between the 2 pnpm-lock.yaml I found vite to have a dependency to a new version 6.0.2 I did force to override on the package.json with vite: 5.4.10 This is my new package.json
|
I think is something specifically with |
This
|
@Lunatic83 , is vite 6.0.3 any better? https://github.com/vitejs/vite/blob/v6.0.3/packages/vite/CHANGELOG.md |
I just tried 6.0.3 and it's still broken 😭 {
"name": "example-basic",
"type": "module",
"scripts": {
"build": "vinxi build",
"dev": "vinxi dev",
"start": "vinxi start",
"version": "vinxi version"
},
"dependencies": {
"@solidjs/meta": "^0.29.4",
"@solidjs/router": "^0.15.0",
"@solidjs/start": "^1.0.10",
"solid-js": "^1.9.3",
"vinxi": "^0.4.3"
},
"pnpm": {
"overrides": {
"vite": "6.0.3"
}
},
"engines": {
"node": ">=18"
}
} |
@caseybaggz what do you see with vinxi 0.5.1? |
Yes! Working package.json & pnPm {
"name": "example-basic",
"type": "module",
"scripts": {
"build": "vinxi build",
"dev": "vinxi dev",
"start": "vinxi start",
"version": "vinxi version"
},
"dependencies": {
"@solidjs/meta": "^0.29.4",
"@solidjs/router": "^0.15.0",
"@solidjs/start": "^1.0.10",
"solid-js": "^1.9.3",
"vinxi": "^0.5.1"
},
"engines": {
"node": ">=18"
}
} |
Explicitly downloading vite@5 in the packages seem to solve the issue. Maybe it's a peer deps issue from vinxi? Had the same problem using pnpm |
@MengLinMaker , in combination with which vinxi versions? |
Duplicates
Latest version
Current behavior 😯
On running npm run dev for new solid start project (using basic template) throws a bunch of errors about trying to use client side only features on server side. Old projects run fine.
Expected behavior 🤔
SolidStart project should start on local host 3000.
Steps to reproduce 🕹
Steps:
vinxi v0.4.3
vinxi starting dev server
WARN No valid compatibility date is specified. nitro 9:59:42 PM
ℹ Using 2024-04-03 as fallback. nitro 9:59:42 PM
Please specify compatibility date to avoid unwanted behavior changes:
- Add compatibilityDate: '2024-11-26' to the config file.
- Or set COMPATIBILITY_DATE=2024-11-26 environment variable.
➜ Local: http://localhost:3000/
➜ Network: use --host to expose
11. ctrl+click on http://localhost:3000/
12. command line updates to:
vinxi v0.4.3
vinxi starting dev server
WARN No valid compatibility date is specified. nitro 9:59:42 PM
ℹ Using 2024-04-03 as fallback. nitro 9:59:42 PM
Please specify compatibility date to avoid unwanted behavior changes:
- Add compatibilityDate: '2024-11-26' to the config file.
- Or set COMPATIBILITY_DATE=2024-11-26 environment variable.
➜ Local: http://localhost:3000/
➜ Network: use --host to expose
9:59:52 PM [vite] page reload vinxi/routes
9:59:52 PM [vite] page reload vinxi/routes (x2)
9:59:52 PM [vite] page reload vinxi/routes (x3)
9:59:54 PM [vite] Error when evaluating SSR module /node_modules/@solidjs/router/dist/index.js:
|- Error: Client-only API called on the server side. Run client-only code in onMount, or conditionally run client-only component with .
at Module.notSup (file:///mnt/c/Users/almos/Documents/Codes/web_dev/datePicker/node_modules/solid-js/web/dist/server.js:1136:9)
at eval (/mnt/c/Users/almos/Documents/Codes/web_dev/datePicker/node_modules/@solidjs/router/dist/index.js:1470:49)
at async instantiateModule (file:///mnt/c/Users/almos/Documents/Codes/web_dev/datePicker/node_modules/vinxi/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:52972:5)
9:59:54 PM [vite] Error when evaluating SSR module /src/app.jsx:
|- Error: Client-only API called on the server side. Run client-only code in onMount, or conditionally run client-only component with .
at Module.notSup (file:///mnt/c/Users/almos/Documents/Codes/web_dev/datePicker/node_modules/solid-js/web/dist/server.js:1136:9)
at eval (/mnt/c/Users/almos/Documents/Codes/web_dev/datePicker/node_modules/@solidjs/router/dist/index.js:1470:49)
at async instantiateModule (file:///mnt/c/Users/almos/Documents/Codes/web_dev/datePicker/node_modules/vinxi/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:52972:5)
9:59:54 PM [vite] Error when evaluating SSR module /node_modules/@solidjs/start/dist/server/StartServer.jsx:
|- Error: Client-only API called on the server side. Run client-only code in onMount, or conditionally run client-only component with .
at Module.notSup (file:///mnt/c/Users/almos/Documents/Codes/web_dev/datePicker/node_modules/solid-js/web/dist/server.js:1136:9)
at eval (/mnt/c/Users/almos/Documents/Codes/web_dev/datePicker/node_modules/@solidjs/router/dist/index.js:1470:49)
at async instantiateModule (file:///mnt/c/Users/almos/Documents/Codes/web_dev/datePicker/node_modules/vinxi/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:52972:5)
9:59:54 PM [vite] Error when evaluating SSR module /node_modules/@solidjs/start/dist/server/index.jsx:
|- Error: Client-only API called on the server side. Run client-only code in onMount, or conditionally run client-only component with .
at Module.notSup (file:///mnt/c/Users/almos/Documents/Codes/web_dev/datePicker/node_modules/solid-js/web/dist/server.js:1136:9)
at eval (/mnt/c/Users/almos/Documents/Codes/web_dev/datePicker/node_modules/@solidjs/router/dist/index.js:1470:49)
at async instantiateModule (file:///mnt/c/Users/almos/Documents/Codes/web_dev/datePicker/node_modules/vinxi/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:52972:5)
9:59:54 PM [vite] Error when evaluating SSR module /src/entry-server.jsx:
|- Error: Client-only API called on the server side. Run client-only code in onMount, or conditionally run client-only component with .
at Module.notSup (file:///mnt/c/Users/almos/Documents/Codes/web_dev/datePicker/node_modules/solid-js/web/dist/server.js:1136:9)
at eval (/mnt/c/Users/almos/Documents/Codes/web_dev/datePicker/node_modules/@solidjs/router/dist/index.js:1470:49)
at async instantiateModule (file:///mnt/c/Users/almos/Documents/Codes/web_dev/datePicker/node_modules/vinxi/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:52972:5)
9:59:54 PM [vite] Error when evaluating SSR module $vinxi/handler/ssr:
|- Error: Client-only API called on the server side. Run client-only code in onMount, or conditionally run client-only component with .
at Module.notSup (file:///mnt/c/Users/almos/Documents/Codes/web_dev/datePicker/node_modules/solid-js/web/dist/server.js:1136:9)
at eval (/mnt/c/Users/almos/Documents/Codes/web_dev/datePicker/node_modules/@solidjs/router/dist/index.js:1470:49)
at async instantiateModule (file:///mnt/c/Users/almos/Documents/Codes/web_dev/datePicker/node_modules/vinxi/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:52972:5)
[h3] [unhandled] H3Error: Client-only API called on the server side. Run client-only code in onMount, or conditionally run client-only component with .
at Module.notSup (file:///mnt/c/Users/almos/Documents/Codes/web_dev/datePicker/node_modules/solid-js/web/dist/server.js:1136:9)
at eval (/mnt/c/Users/almos/Documents/Codes/web_dev/datePicker/node_modules/@solidjs/router/dist/index.js:1470:49)
at async instantiateModule (file:///mnt/c/Users/almos/Documents/Codes/web_dev/datePicker/node_modules/vinxi/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:52972:5) {
cause: Error: Client-only API called on the server side. Run client-only code in onMount, or conditionally run client-only component with .
at Module.notSup (file:///mnt/c/Users/almos/Documents/Codes/web_dev/datePicker/node_modules/solid-js/web/dist/server.js:1136:9)
at eval (/mnt/c/Users/almos/Documents/Codes/web_dev/datePicker/node_modules/@solidjs/router/dist/index.js:1470:49)
at async instantiateModule (file:///mnt/c/Users/almos/Documents/Codes/web_dev/datePicker/node_modules/vinxi/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:52972:5),
statusCode: 500,
fatal: false,
unhandled: true,
statusMessage: undefined,
data: undefined
}
Context 🔦
run new SolidStart project in dev mode successfully. Old projects run fine.
Your environment 🌎
System: OS Name: Microsoft Windows 11 Home OS Version: 10.0.22631 N/A Build 22631 System Type: x64-based PC Processor(s): 1 Processor(s) Installed. [01]: Intel64 Family 6 Model 154 Stepping 3 GenuineIntel ~2700 Mhz Binaries: Node: v20.13.1 npm: 10.9.0
The text was updated successfully, but these errors were encountered: