MIRACLE LINUX Denoをインストールする

MIRACLE LINUX Denoをインストールする

MIRACLE LINUXで、Denoをインストールするまでの手順です。

環境

  • OS MIRACLE LINUX release 8.4 (Peony)

Denoインストール

下記のコマンド1つで、インストールすることができます。

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

PATHを通す必要があります。

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

永続化するには「.bash_profile」に追加します。

$ echo 'export DENO_INSTALL="/home/testuser/.deno"' >> ~/.bash_profile
$ echo 'export PATH="$DENO_INSTALL/bin:$PATH"' >> ~/.bash_profile

「.bash_profile」に追加した内容を、反映させます。

$ exec $SHELL -l

バージョンを確認してみます。

$ deno --version

deno 1.14.3 (release, x86_64-unknown-linux-gnu)
v8 9.4.146.19
typescript 4.4.2

以下のコマンドを実行すると、「deno」のサンプルコードを実行することができます。

$ deno run https://deno.land/std/examples/welcome.ts

Download https://deno.land/std/examples/welcome.ts
Warning Implicitly using latest version (0.110.0) for https://deno.land/std/examples/welcome.ts
Download https://deno.land/std@0.110.0/examples/welcome.ts
Check https://deno.land/std/examples/welcome.ts
Welcome to Deno!

Hello Worldしてみる

hello.tsという名前でファイルを作成して下記の内容を記述します。

$ nano hello.ts

console.log('Hello World');

実行してみます。

$ deno run hello.ts

Check file:///home/testuser/test/hello.ts
Hello World