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

Vite Deno templates do not work #31

Closed
OkGameStudios opened this issue Apr 29, 2023 · 7 comments · Fixed by denoland/deno#18948
Closed

Vite Deno templates do not work #31

OkGameStudios opened this issue Apr 29, 2023 · 7 comments · Fixed by denoland/deno#18948

Comments

@OkGameStudios
Copy link

OkGameStudios commented Apr 29, 2023

When i try to create a deno + framework template it gives me this error when running the app.
image
I originally wanted to try react but after it not working i tried it for svelte too with the same error. Please tell me how to fix it and correct the issue.

deno: 1.33.1
node: 16.14.2
Os: Windows 10

@OkGameStudios
Copy link
Author

This is the whole console in text
Task dev deno run -A --node-modules-dir npm:vite failed to load config from C:\Users\HP\Desktop\deno\svelte-test\vite.config.mjs error when starting dev server: TypeError: Could not resolve 'esbuild' from 'file:///C:/Users/HP/Desktop/deno/svelte-test/node_modules/.deno/@[email protected]/node_modules/vite/dist/node/index.js'. Caused by: could not find package 'esbuild' from referrer 'file:///C:/Users/HP/Desktop/deno/svelte-test/node_modules/.deno/@[email protected]/node_modules/vite/dist/node/index.js'. at async loadConfigFromBundledFile (file:///C:/Users/HP/Desktop/deno/svelte-test/node_modules/.deno/[email protected]/node_modules/vite/dist/node/chunks/dep-a178814b.js:64414:21) at async loadConfigFromFile (file:///C:/Users/HP/Desktop/deno/svelte-test/node_modules/.deno/[email protected]/node_modules/vite/dist/node/chunks/dep-a178814b.js:64296:28) at async resolveConfig (file:///C:/Users/HP/Desktop/deno/svelte-test/node_modules/.deno/[email protected]/node_modules/vite/dist/node/chunks/dep-a178814b.js:63904:28) at async _createServer (file:///C:/Users/HP/Desktop/deno/svelte-test/node_modules/.deno/[email protected]/node_modules/vite/dist/node/chunks/dep-a178814b.js:63190:20) at async CAC.<anonymous> (file:///C:/Users/HP/Desktop/deno/svelte-test/node_modules/.deno/[email protected]/node_modules/vite/dist/node/cli.js:733:24)

@bluwy
Copy link
Owner

bluwy commented Apr 30, 2023

Hmm I also got that on deno 1.33.1 macos. Downgrading to 1.32.0 works, and I see 1.33.0 has stricter hoisting in node_modules that seems to be causing the issue. I wonder if it's similar to denoland/deno#18924. cc @bartlomieju

@bartlomieju
Copy link
Contributor

Thanks for the ping. I will look into this issue ASAP.

@bartlomieju
Copy link
Contributor

Opened a PR that fixes the problem. This fix will be released in Deno v1.32.2 later this week. Thanks for the report!

bartlomieju added a commit to denoland/deno that referenced this issue May 2, 2023
This commit changes how paths for npm packages are handled,
by canonicalizing them when resolving. This is done so that instead
of returning
"node_modules/<package_name>@<version>/node_modules/<dep>/index.js"
(which is a symlink) we "node_modules/<dep>@<dep_version>/index.js.

Fixes #18924
Fixes bluwy/create-vite-extra#31

---------

Co-authored-by: David Sherret <[email protected]>
levex pushed a commit to denoland/deno that referenced this issue May 4, 2023
This commit changes how paths for npm packages are handled,
by canonicalizing them when resolving. This is done so that instead
of returning
"node_modules/<package_name>@<version>/node_modules/<dep>/index.js"
(which is a symlink) we "node_modules/<dep>@<dep_version>/index.js.

Fixes #18924
Fixes bluwy/create-vite-extra#31

---------

Co-authored-by: David Sherret <[email protected]>
@sortofsleepy
Copy link

sortofsleepy commented May 9, 2023

👋

Not sure if this should be a new issue or not since I initially ran into this issue but it has since morphed into a similar issue from #9, in any case, since this is still Vite/Deno related presumably figured I'd start here :

Upgrade to Deno resolved the esbuild error, but now I'm getting the following when I run deno task dev

error: Uncaught Error: EINVAL: invalid argument, stat
    at __node_internal_captureLargerStackTrace (ext:deno_node/internal/errors.ts:89:11)
    at __node_internal_uvException (ext:deno_node/internal/errors.ts:182:12)
    at denoErrorToNodeError (ext:deno_node/internal/errors.ts:1826:16)
    at ext:deno_node/_fs/_fs_stat.ts:83:97
    at eventLoopTick (ext:core/01_core.js:181:11)

  • I am on Windows
  • Node is v18.16.0
  • Deno is
deno 1.33.2 (release, x86_64-pc-windows-msvc)
v8 11.4.183.1
typescript 5.0.3

Not sure where to start debugging, still a little new to how Deno works.

Let me know if I should put this in a new issue.

@bartlomieju
Copy link
Contributor

@sortofsleepy thanks for the report. Would you mind opening an issue in the Deno repo? This looks like an internal error in Deno that should be fixed there.

@bluwy
Copy link
Owner

bluwy commented Jul 4, 2023

Closing as Deno 1.32.2 is released.

@bluwy bluwy closed this as completed Jul 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants