fresh icon indicating copy to clipboard operation
fresh copied to clipboard

Warn on outdated Deno version in dev

Open kuroidoruido opened this issue 3 months ago • 6 comments

I wanted to create a new project with Deno + Fresh, and I had some issues.

1. the message after init does not indicate to run deno install;

I think it will be easier for newcomers to indicates all required commands.

Here, if I follow the initialization message:

Project initialized!

Enter your project directory using cd fresh-project.
Run deno task dev to start the project. CTRL-C to stop.

Stuck? Join our Discord https://discord.gg/deno 

Happy hacking! 🦕

I should only run deno task dev, but if I only run this, I get a vite: command not found.

Maybe the initialization message miss deno install indication?

2. installing dependencies is not working

If I run deno install, I get this error message:

error: The Wasm module could not be parsed: not a Wasm module
  Specifier: https://jsr.io/@deno/loader/0.3.6/src/lib/rs_lib.wasm

3. Error running deno task dev

It may be linked to the error 2, but I also tried to run deno task dev and I got this:

failed to load config from /tmp/fresh-test/fresh-project/vite.config.ts
error when starting dev server:
Error: Cannot find module '@fresh/plugin-vite'
Require stack:
- /tmp/fresh-test/fresh-project/vite.config.ts
- /tmp/fresh-test/fresh-project/node_modules/.deno/[email protected]/node_modules/vite/dist/node/chunks/dep-Bm2ujbhY.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1207:15)
    at Module._load (node:internal/modules/cjs/loader:1038:27)
    at Module.require (node:internal/modules/cjs/loader:1289:19)
    at require (node:internal/modules/helpers:182:18)
    at Object.<anonymous> (/tmp/fresh-test/fresh-project/vite.config.ts:26:26)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at _require.extensions.<computed> [as .js] (file:///tmp/fresh-test/fresh-project/node_modules/.deno/[email protected]/node_modules/vite/dist/node/chunks/dep-Bm2ujbhY.js:36240:44)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Can you help me?

Project creation as gif (if it can help):

Image

kuroidoruido avatar Sep 25 '25 09:09 kuroidoruido

Deno 2.1.1 is quite ancient. Upgrading to the latest deno version will resolve this issue. The current version at the time of this writing is 2.5.1.

marvinhagemeister avatar Sep 25 '25 10:09 marvinhagemeister

I updated deno to 2.5.1 (already made but did not realize I had a deno installed on ~/.deno) and it's working now.

Maybe minimum Deno version should be indicated in the Fresh documentation or/and checked at start?

kuroidoruido avatar Sep 25 '25 11:09 kuroidoruido

Maybe minimum Deno version should be indicated in the Fresh documentation or/and checked at start?

FYI, here is a bit clarification about the last point -> https://github.com/denoland/fresh/pull/3486#pullrequestreview-3263495661

fry69 avatar Sep 25 '25 11:09 fry69

Maybe minimum Deno version should be indicated in the Fresh documentation or/and checked at start?

FYI, here is a bit clarification about the last point -> #3486 (review)

I agree it's not on the fresh runtime to check that, but maybe it can be done on the vite fresh plugin?

kuroidoruido avatar Sep 25 '25 11:09 kuroidoruido

maybe it can be done on the vite fresh plugin?

Checking during build time? Interesting idea 🤔 but it may still not get accepted, see below:

For clarification, with Vite, the "Fresh runtime" becomes a Vite plugin. Even if you use the legacy builder, with Fresh 2 you always run the generated artifacts from the _fresh folder in production.

The contested part here is that the Fresh should not make a network call to check if the version is outdated. Also my initial assumption that Fresh should always run with the latest released Deno version seems to be wrong, so this check may be misleading.

fry69 avatar Sep 25 '25 11:09 fry69

I don't mind checking the deno version during dev, just not in prod. So it would be perfectly fine to add this functionality next to the fresh version update checker. The way Deno's update checker works is similar, so we might be able to piggy back on that one and check if that file exists locally, rather than doing the network request ourselves.

marvinhagemeister avatar Sep 25 '25 12:09 marvinhagemeister