[英]How to Install Deno on Ubuntu
The command I run is:我运行的命令是:
curl -fsSL https://deno.land/x/install/install.sh | sh
The output is: output 是:
######################################################################## 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.在此之后,我在终端中运行
deno
,它给了我一个错误。
Can anyone explain how to install Deno in Ubuntu properly?谁能解释如何在 Ubuntu 中正确安装 Deno?
Installing Deno by running the following command from it's official website通过在其官方网站上运行以下命令来安装 Deno
curl -fsSL https://deno.land/x/install/install.sh | sh
After installing it update .bashrc
file in your profile directory:安装后更新配置文件目录中的
.bashrc
文件:
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您可以从安装 deno 后收到的消息中获取这两行
finally run the following command source ~/.bashrc
最后运行以下命令
source ~/.bashrc
after that run deno by typing this command in terminal deno
之后通过在终端
deno
This video explain the installation process in details Installing deno on ubuntu该视频详细解释了安装过程 在ubuntu 上安装 deno
Open your terminal and run this打开你的终端并运行它
curl -fsSL https://deno.land/x/install/install.sh | sh
username: open termianla and run whoami
用户名:打开 termianla 并运行
whoami
Now set path in.bashrc file现在在.bashrc 文件中设置路径
run nano.bashrc
for open file and put below code with replacing with username为打开的文件运行
nano.bashrc
并将下面的代码替换为用户名
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
最后运行以下命令
source ~/.bashrc
now run deno
in your terminal现在在你的终端中运行
deno
The installer already telling you what to do after installation is finished:安装程序已经告诉您安装完成后要做什么:
Manually add the directory to your $HOME/.bash_profile (or similar)
手动将目录添加到您的 $HOME/.bash_profile (或类似)
export DENO_INSTALL="/root/.deno"出口 DENO_INSTALL="/root/.deno"
export PATH="$DENO_INSTALL/bin:$PATH"导出 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)您可以直接在终端中运行这两行以开始在当前终端中使用它,或者只需编辑并将它们添加到
$HOME/.bashrc
或$HOME/.bash_profile
(或类似)
You have to add the following commands after the installation to your bash profile.您必须在安装后将以下命令添加到您的 bash 配置文件中。 Usually
~/.bashrc
or ~./bash_profile
通常是
~/.bashrc
或~./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:正如您在安装的 output 中看到的:
Deno was installed successfully to /root/.deno/bin/deno.
Deno 已成功安装到 /root/.deno/bin/deno。
Manually add the directory to your $HOME/.bash_profile (or similar)
手动将目录添加到您的 $HOME/.bash_profile (或类似)
Once you have added those two lines you can start a new terminal, or just load your bash profile using source
command添加这两行后,您可以启动一个新终端,或者使用
source
命令加载您的 bash 配置文件
source ~/.bashrc
# or source ~/.bash_profile
If you want to install a specific version you can do so adding: -s {version}
to that command:如果要安装特定版本,可以在该命令中添加:
-s {version}
:
curl -fsSL https://deno.land/x/install/install.sh | sh -s v0.42.0
You have to configure globally in ubuntu system.您必须在 ubuntu 系统中进行全局配置。 So first of all,
所以首先,
nano ~/.bashrc
source ~/.bashrc
Then just source bashrc file.然后只需 source bashrc 文件。
source ~/.bashrc
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
You have to add the scripts in your bashrc
profile.您必须在
bashrc
配置文件中添加脚本。
Open the bashrc
file with any command below and add the scripts at the end of the file.使用以下任何命令打开
bashrc
文件,并在文件末尾添加脚本。 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详细说明: 如何在 Windows、Mac 和 Linux 操作系统上安装 Deno
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.它告诉你需要 go 到
$HOME/.bash_profile
或类似的文件来添加这个配置。
export DENO_INSTALL="/root/.deno"
export PATH="$DENO_INSTALL/bin:$PATH"
Here is how to add it step by step这是逐步添加它的方法
sudo nano ~/.bash_profile
or sudo nano ~/.bashrc
(I use this because my OS is Ubuntu) sudo nano ~/.bash_profile
或sudo nano ~/.bashrc
(我使用这个是因为我的操作系统是 Ubuntu)export DENO_INSTALL="/root/.deno"
export PATH="$DENO_INSTALL/bin:$PATH"
Note: for those who are using Ubuntu, it is a little bit different.注意:对于使用 Ubuntu 的人来说,有点不同。
export DENO_INSTALL="/$HOME/.deno"
export PATH="$DENO_INSTALL/bin:$PATH"
deno --version
to check.deno --version
进行检查。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.