denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
97.39k stars 5.36k forks source link

Deno lockfile can't handle ">=2.0.0-rc.0" versions. #25649

Closed birkskyum closed 1 month ago

birkskyum commented 1 month ago

Version: deno 2.0.0-rc.2

I tried making a new Tauri 2 rc app:

npm create tauri-app@latest -- --rc

stepped through with defaults (deno isn't an option for package manager, so picked npm)

cd tauri2-app
deno install

Saw something about esbuild not running postinstall for security reasons:

Warning Packages contained npm lifecycle scripts (preinstall/install/postinstall) that were not executed.
    This may cause the packages to not work correctly. To run them, use the `--allow-scripts` flag with `deno cache` or `deno install`
    (e.g. `deno cache --allow-scripts=pkg1,pkg2 <entrypoint>` or `deno install --allow-scripts=pkg1,pkg2`):
      npm:esbuild@0.21.5

I know it's firing an install.js script, and I actually wanted that, so I fired it myself: deno install --allow-scripts=npm:esbuild

Error:

error: Failed reading lockfile at '/Users/admin/repos/deno-kitchensink/tauri2-app/deno.lock'

Caused by:
    0: Failed deserializing. Lockfile may be corrupt
    1: Invalid package requirement '@tauri-apps/api@>=2.0.0-rc.0'
    2: Invalid specifier version requirement
    3: Unexpected character.
         >=2.0.0-rc.0
         ~

Also comes with just deno install

bartlomieju commented 1 month ago

Isn't it switching between v1.x and 2.0 versions? The new lockfile is not backwards compatible - in Deno 2 it migrates automatically to version 4, but v1.x can't read it.

birkskyum commented 1 month ago

Tried again to verify:

The deno version is deno 2.0.0-rc.2 The lockfile is version 4 - In this repro it's made directly from a package.json, not migrated from a previous lockfile.

bartlomieju commented 1 month ago

@dsherret please take a look

birkskyum commented 1 month ago

Sidenote: I also never found the right syntax to make the deno run -A npm:create-tauri-app@latest -- --rc pick up on the --rc flag to make a Tauri 2 app. When I run the creation command with deno, I always end up with a Tauri 1 app, so that's why I used npm create -- --rc or pnpm create --rc (less dashed needed for pnpm apparently)