deno

Installing Deno error: JSR package manifest for '@deno/installer-shell-setup' failed to load


I would like to install Deno with the following command:

curl -fsSL https://deno.land/install.sh | sh

After extracting the binary, I got the following error:

######################################################################## 100.0%
Archive:  /home/<user>/.deno/bin/deno.zip
  inflating: /home/<user>/.deno/bin/deno  
Deno was installed successfully to /home/<user>/.deno/bin/deno
error: JSR package manifest for '@deno/installer-shell-setup' failed to load. Import 'https://jsr.io/@deno/installer-shell-setup/meta.json' failed: error sending request for url (https://jsr.io/@deno/installer-shell-setup/meta.json): client error (Connect): invalid peer certificate: UnknownIssuer

Unfortunately, the @deno/installer-shell-setup package can not be loaded because of certification error. It is highly probable because I connected to corporate network.

Is it possible to continue the installer setup?


Solution

  • In this case, since the deno binary was successfully downloaded, you might be able to complete running the installer by manually running the next step manually and adding the --unsafely-ignore-certificate-errors flag to ignore this error, like this:

    $ "$HOME/.deno/bin/deno" run --unsafely-ignore-certificate-errors -A --reload jsr:@deno/installer-shell-setup/bundled "$HOME/.deno"
    

    This should complete the installation by configuring your shell's PATH and completions.


    More generally, it's not necessary to use the installer to install Deno; it's just for convenience.

    As described in the Installation section of the documentation, Deno is distributed as a single binary. You can download the latest binary for your platform from their Releases page on GitHub (or you can build it from source if you really want to: it will be slow, but it should work without much hassle if you have Rust/Cargo installed).

    For example, on Mac OS, I download it with wget, unzip it with unzip, and then I can run the deno binary:

    $ wget https://github.com/denoland/deno/releases/download/v1.46.3/deno-x86_64-apple-darwin.zip
    ...
    2024-10-02 15:43:34 (47.8 MB/s) - ‘deno-x86_64-apple-darwin.zip’ saved [43844272/43844272]
    
    $ unzip deno-x86_64-apple-darwin.zip 
    Archive:  deno-x86_64-apple-darwin.zip
      inflating: deno
    
    $ ./deno --version
    deno 1.46.3 (stable, release, x86_64-apple-darwin)
    v8 12.9.202.5-rusty
    typescript 5.5.2
    

    The installer script would move the binary to ~/.deno/bin, then prompt you to modify your shell configuration (.bash_profile or similar) to add that directory to your PATH. You can do that yourself:

    $ mkdir -p ~/.deno/bin
    
    $ mv ./deno ~/.deno/bin/deno
    
    $ echo 'export PATH="$PATH:$HOME/.deno/bin/deno"' >> ~/.bash_profile
    

    The installer supports shells other than Bash, and can set up completion for Deno subcommands. If you need that, you'll need to dig a bit deeper than what I've describe here.