如果你通过curl已经成功安装了deno,却出现command not found: deno,是因为环境变量没配置好。

  • 如果你用的终端是bash(macOS Catalina之前版本默认终端),那么在~/.bash_profile中添加下面的环境变量(admin要换成你的用户名):
    export DENO_INSTALL="/Users/admin/.deno"
    export PATH="$DENO_INSTALL/bin:$PATH"

    保存后,在终端执行source ~/.bash_profile,然后应该就可以使用deno了。

  • 如果你用的终端是zsh(macOS Catalina +默认的终端),你需要在~/.zshrc中添加上面的环境变量。

    如果你不想在~/.zshrc中添加,就是想在~/.bash_profile中添加,那么就把source ~/.bash_profile添加到~/.zshrc中。

别忘记重启终端。