LoginSignup
0
0

More than 1 year has passed since last update.

Denoを試す(hello worldまで)

Posted at

Deno(ディノ)とは

  • DenoはRyan Dahl(Node.jsの製作者)によるJS/TSランタイム
  • Node.jsの問題点を改良するために作られたランタイムで、開発体験やセキュリティを意識した設計になっている

今回は公式ドキュメントに沿ってトライする

環境

macOS Monterey(version:12.5)
Apple M1 Pro

インストール

公式の通りに次のコマンドを実行する。

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

実行結果

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

Stuck? Join our Discord https://discord.gg/deno

バージョン確認

$ deno --version
zsh: command not found: deno

エラーが出た。
pathが通ってないのが原因なので通す。

vi ~/.zshenvで以下を追記して更新

export DENO_INSTALL=~/.deno
export PATH=$DENO_INSTALL/bin:$PATH

設定反映

$ source ~/.zshenv

バージョン再確認

$ deno --version
deno 1.32.3 (release, aarch64-apple-darwin)
v8 11.2.214.9
typescript 5.0.3

出来た。

環境設定(VSCode)

拡張機能をインストール

公式のハンズオンを試す

first_steps.ts
console.log("Welcome to Deno!");
// $ deno run first_steps.ts
// => Welcome to Deno!
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0