Skip to content
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

with-vitest no SSR Cannot find module error #720

Closed
dtbenson43 opened this issue Feb 5, 2023 · 7 comments
Closed

with-vitest no SSR Cannot find module error #720

dtbenson43 opened this issue Feb 5, 2023 · 7 comments

Comments

@dtbenson43
Copy link

dtbenson43 commented Feb 5, 2023

OS: Microsoft Windows 11 Home
Version: 10.0.22000 Build 22000

I use npm init solid@latest
I select "with-vitest"
I select "n" when prompted about SSR
I select "Y" when prompted about typescript

when I run npm run dev

I get this error in the terminal:

GET http://localhost:3000/
An unhandled error occured: Error: Cannot find module 'C:UsersdbensDocumentsGitHub
ite-solid-typescript
ode_modulessolid-startdevCsrRoot.tsx' imported from 'C:/Users/dbens/Documents/GitHub/vite-solid-typescript/node_modules/solid-start/entry-server/StartServer.tsx'
    at viteResolve (file:///C:/Users/dbens/Documents/GitHub/vite-solid-typescript/node_modules/vite/dist/node/chunks/dep-5605cfa4.js:53393:25)
    at nodeImport (file:///C:/Users/dbens/Documents/GitHub/vite-solid-typescript/node_modules/vite/dist/node/chunks/dep-5605cfa4.js:53430:15)
    at ssrImport (file:///C:/Users/dbens/Documents/GitHub/vite-solid-typescript/node_modules/vite/dist/node/chunks/dep-5605cfa4.js:53318:20)
    at eval (/node_modules/solid-start/entry-server/StartServer.tsx:16:37)
    at async instantiateModule (file:///C:/Users/dbens/Documents/GitHub/vite-solid-typescript/node_modules/vite/dist/node/chunks/dep-5605cfa4.js:53364:9)

and this error is displayed at localhost:3000:

An error occured while server rendering /:

	Cannot find module 'C:UsersdbensDocumentsGitHub�ite-solid-typescript
ode_modulessolid-startdevCsrRoot.tsx' imported from 'C:/Users/dbens/Documents/GitHub/vite-solid-typescript/node_modules/solid-start/entry-server/StartServer.tsx'
Error: Cannot find module 'C:UsersdbensDocumentsGitHub�ite-solid-typescript
ode_modulessolid-startdevCsrRoot.tsx' imported from 'C:/Users/dbens/Documents/GitHub/vite-solid-typescript/node_modules/solid-start/entry-server/StartServer.tsx'
    at viteResolve (file:///C:/Users/dbens/Documents/GitHub/vite-solid-typescript/node_modules/vite/dist/node/chunks/dep-5605cfa4.js:53393:25)
    at nodeImport (file:///C:/Users/dbens/Documents/GitHub/vite-solid-typescript/node_modules/vite/dist/node/chunks/dep-5605cfa4.js:53430:15)
    at ssrImport (file:///C:/Users/dbens/Documents/GitHub/vite-solid-typescript/node_modules/vite/dist/node/chunks/dep-5605cfa4.js:53318:20)
    at eval (/node_modules/solid-start/entry-server/StartServer.tsx:16:37)
    at async instantiateModule (file:///C:/Users/dbens/Documents/GitHub/vite-solid-typescript/node_modules/vite/dist/node/chunks/dep-5605cfa4.js:53364:9
Click outside or fix the code to dismiss.
You can also disable this overlay by setting server.hmr.overlay to false in vite.config.js.

If I repeat the process with SSR on or I remove the ssr: false property from the solid options vite.config.ts the project works

Not sure what the issue could be

@atk
Copy link
Contributor

atk commented Feb 5, 2023

It seems you're running this directly on Windows without WSL; this is currently untested. I need to setup a test VM, since I'm on Linux.

@dtbenson43
Copy link
Author

It seems you're running this directly on Windows without WSL; this is currently untested. I need to setup a test VM, since I'm on Linux.

yes I'm running directly on windows

@AlexErrant
Copy link
Contributor

I believe this is a regression with @latest. Can you try with these versions? (I'd try myself but gotta dash for now.)

    "solid-js": "^1.6.9",
    "solid-start": "^0.2.15",

@dtbenson43
Copy link
Author

dtbenson43 commented Feb 6, 2023

I believe this is a regression with @latest. Can you try with these versions? (I'd try myself but gotta dash for now.)

    "solid-js": "^1.6.9",
    "solid-start": "^0.2.15",

I installed these versions of solid-js and solid-start and the project now runs without error using npm run dev

appears to be running in SSR mode even though I selected no for that prompt and ssr: false is in the solid options.

@AlexErrant
Copy link
Contributor

(on my phone cause I'm mad) some ssr occurs in dev for 'ssr:false'. See #519 (comment)

@dtbenson43
Copy link
Author

(on my phone cause I'm mad) some ssr occurs in dev for 'ssr:false'. See #519 (comment)

ah okay that makes sense, thank you for the help

@ryansolid
Copy link
Member

ryansolid commented Feb 6, 2023

That issue of code being run on ssr: false in dev should have been fixed which is where this new issue was introduced specifically on windows. I didn't expect an issue as the path handling here is identical to other locations but apparently something breaks here specifically. Looking into it best I can without a windows setup.

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

No branches or pull requests

4 participants