Skip to content

Latest commit

 

History

History
91 lines (58 loc) · 3.45 KB

DenoSetup.md

File metadata and controls

91 lines (58 loc) · 3.45 KB

Setting Up Deno

Installing Deno

View the online installation guide here, or run the following script:

curl -fsSL https://deno.land/x/install/install.sh | sh -s v1.6.3

Configure Bash (Windows, Git Bash)

After installation, run the following commands.

This command will create a bash configuration file that allows you to easily add Deno onto your path (giving you the option to run the deno command straight from bash) as well as adding Deno to your path.

echo 'export PATH=$HOME/.deno/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
source ~/.bash_profile

At this point, you will likely have to restart your machine or at least your Bash instance for your new configuration to take effect.

This command will generate a file structure to allow you to add autocompletion for different bash scripts

mkdir ~/.etc && mkdir ~/.etc/bash_completion.d

This command generates a file for Deno autocompletion

deno completions bash > ~/.etc/bash_completion.d/deno.bash

This command adds the newly-generated completions script to your Bash configuration

echo "source ~/.etc/bash_completion.d/deno.bash" >> ~/.bashrc

Configure ZShell (Mac)

After installation, run the following commands.

This command will create a bash configuration file that allows you to easily add Deno onto your path (giving you the option to run the deno command straight from bash) as well as adding Deno to your path.

echo 'export PATH=$HOME/.deno/bin:$PATH' >> ~/.zshrc
source ~/.zshrc

At this point, you will likely have to restart your machine or at least your Bash instance for your new configuration to take effect.

This command will generate a file structure to allow you to add autocompletion for different bash scripts

mkdir ~/.zsh

This command generates a file for Deno autocompletion

deno completions zsh > ~/.zsh/_deno

This command adds the newly-generated completions script to your Bash configuration

echo "fpath=(~/.zsh $fpath)\nautoload -Uz compinit\ncompinit -u" >> ~/.zshrc
source ~/.zshrc

Test Your Deno Install

First, run deno --version to check the status of your install. If it correctly returns your version information, then you can try to run the following example code:

deno run --allow-net=example.com https://deno.land/std@0.83.0/examples/curl.ts https://example.com

run is the Deno command for running a script file. The --allow-net flag grants Deno access to your network connection. The first URL links to the script you will be running, which is a Deno example script. The second URL is the URL of the website you will be fetching. If the script runs correctly, it should print HTML code to your console.

Configure VSCode

All it takes to setup VS Code for Deno is to install the extension from the extensions marketplace.

I also recommend you to install the ESLint and Prettier extensions, as this workspaces utilizes them heavily.

It is higly recommended to reset your VSCode instance after following these instructions! If you are still recieving errors, try restarting your computer. As a last step, please reach out to a project manager for assistance.