15

The command I run is:

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

The output is:

######################################################################## 100.0%
Archive:  /root/.deno/bin/deno.zip
  inflating: deno
Deno was installed successfully to /root/.deno/bin/deno
Manually add the directory to your $HOME/.bash_profile (or similar)
  export DENO_INSTALL="/root/.deno"
  export PATH="$DENO_INSTALL/bin:$PATH"
Run '/root/.deno/bin/deno --help' to get started

After this, I run deno in the terminal and it gives me an error.

Can anyone explain how to install Deno in Ubuntu properly?

Penny Liu
  • 15,447
  • 5
  • 79
  • 98
Parth kharecha
  • 6,135
  • 4
  • 25
  • 41

8 Answers8

20

Installing Deno by running the following command from it's official website

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

After installing it update .bashrc file in your profile directory:

sudo nano ~/.bashrc

then add these two lines in the file

 export DENO_INSTALL="/$HOME/.deno"
 export PATH="$DENO_INSTALL/bin:$PATH"

you can get this two lines from the message you get after installing deno after

finally run the following command source ~/.bashrc

after that run deno by typing this command in terminal deno

This video explain the installation process in details Installing deno on ubuntu

Greg Wozniak
  • 5,209
  • 3
  • 26
  • 29
Ahmed Mahmoud
  • 1,724
  • 1
  • 17
  • 21
  • This works great, except that the command to edit the file should be `sudo nano ~/.bashrc` since you could easily be in a directory other than `~` – Andrew Koster Aug 27 '20 at 23:19
6

Open your terminal and run this

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

username: open termianla and run whoami

Now set path in .bashrc file

run nano .bashrc for open file and put below code with replacing with username

export DENO_INSTALL="/root/.deno"
export PATH="$DENO_INSTALL/bin:$PATH"
export PATH="/home/username/.deno/bin:$PATH"

finally run the following command source ~/.bashrc

now run deno in your terminal

Parth kharecha
  • 6,135
  • 4
  • 25
  • 41
3

The installer already telling you what to do after installation is finished:

Manually add the directory to your $HOME/.bash_profile (or similar)
export DENO_INSTALL="/root/.deno"
export PATH="$DENO_INSTALL/bin:$PATH"


export DENO_INSTALL="/root/.deno" 
export PATH="$DENO_INSTALL/bin:$PATH"

You can just run the two lines in the terminal directly to start using it in your current terminal or just edit and add them to $HOME/.bashrc or $HOME/.bash_profile (or similar)

ROOT
  • 11,363
  • 5
  • 30
  • 45
  • The installer tells you to run commands that will make it SEEM like Deno is installed. However, whenever you start a new shell, you lose the modified PATH variable. – Andrew Koster Jun 26 '20 at 03:26
3

You have to add the following commands after the installation to your bash profile. Usually ~/.bashrc or ~./bash_profile

export DENO_INSTALL="/root/.deno"
export PATH="$DENO_INSTALL/bin:$PATH"

(please have in mind that the above commands may change, so always use the values you got from the installation output)

As you can see in the output of the installation:

Deno was installed successfully to /root/.deno/bin/deno.

Manually add the directory to your $HOME/.bash_profile (or similar)

Once you have added those two lines you can start a new terminal, or just load your bash profile using source command

source ~/.bashrc
# or source ~/.bash_profile

If you want to install a specific version you can do so adding: -s {version} to that command:

curl -fsSL https://deno.land/x/install/install.sh | sh -s v0.42.0
Marcos Casagrande
  • 37,983
  • 8
  • 84
  • 98
  • 1
    The root was /home/$USER/ in my case. – Manuel Eguiluz May 17 '20 at 22:05
  • You're right, I added a note regarding that, since I used OP values. – Marcos Casagrande May 17 '20 at 22:09
  • Is it `.bashrc`, or `.bashprofile`? The installer is giving us ambiguous instructions and I think people want clarification, not more choices to make. – Andrew Koster Jun 26 '20 at 03:30
  • Both files can be used. I think people need to know all options. As a Linux user you know which bash profile you're using anyways. – Marcos Casagrande Jun 26 '20 at 07:51
  • It's good to note both options, but only someone who has messed with their Bash settings recently would know which one they're using. Anyone who is just using the Ubuntu defaults (or who hasn't touched them recently) would not know. The default on Ubuntu 20 is `~/.bashrc`, for the record. – Andrew Koster Aug 27 '20 at 23:24
2

You have to configure globally in ubuntu system. So first of all ,

nano ~/.bashrc
Edit the .bashrc file and add this below code
export DENO_INSTALL="/root/.deno"
export PATH="$DENO_INSTALL/bin:$PATH"

Then just source bashrc file.

source ~/.bashrc
2

I was also facing the same issue but below command worked for me:

curl -fsSL https://deno.land/x/install/install.sh | sudo DENO_INSTALL=/usr/local sh
0

You have to add the scripts in your bashrc profile.

Open the bashrc file with any command below and add the scripts at the end of the file. After saving the file, restart your terminal.

# for gedit text editor
gedit ~/.bashrc
# or for GNU nano editor
nano ~/.bashrc
# deno
export DENO_INSTALL="/home/YOUR_USERNAME/.deno"
export PATH="$DENO_INSTALL/bin:$PATH"

Full explanation with details: How to install Deno on Windows, Mac, and Linux Operating Systems

Mejan
  • 918
  • 13
  • 18
0

You just follow the command line

######################################################################## 100.0%
Archive:  /root/.deno/bin/deno.zip
  inflating: deno
Deno was installed successfully to /root/.deno/bin/deno
Manually add the directory to your $HOME/.bash_profile (or similar)
  export DENO_INSTALL="/root/.deno"
  export PATH="$DENO_INSTALL/bin:$PATH"
Run '/root/.deno/bin/deno --help' to get started

It tell you that you need to go to $HOME/.bash_profile or similar one to add this configuration.

export DENO_INSTALL="/root/.deno"
export PATH="$DENO_INSTALL/bin:$PATH"

Here is how to add it step by step

  1. sudo nano ~/.bash_profile or sudo nano ~/.bashrc (I use this because my OS is Ubuntu)
  2. Copy this line into that file
export DENO_INSTALL="/root/.deno"
export PATH="$DENO_INSTALL/bin:$PATH"

Note: for those who are using Ubuntu, it is a little bit different.

export DENO_INSTALL="/$HOME/.deno"
export PATH="$DENO_INSTALL/bin:$PATH"
  1. Store
  • CTRL + O and Enter to save.
  • CTRL + X to close the file.
  1. Close the terminal, open again and type deno --version to check.
Hoang Subin
  • 6,610
  • 6
  • 37
  • 56