【问题标题】:Unable to install DFINITY Canister SDK on Ubuntu无法在 Ubuntu 上安装 DFINITY Canister SDK
【发布时间】:2021-01-21 12:21:31
【问题描述】:

我正在按照找到here 的步骤安装DFINITY Canister SDK
当我运行以下命令时,不会创建目录dfx(在/bin 下),随后无法识别dfx 命令:

adel@adel-VirtualBox:~$ sh -ci "$(curl -fsSL https://sdk.dfinity.org/install.sh)"

info: Executing DFINITY SDK install script, commit: dd2134837704e0daca074dd3fe09ee4ff6ebbf97

 DFINITY SDK 
 Please READ the following license: 

DFINITY Foundation -- All rights reserved. This is an ALPHA version
of the DFINITY Canister Software Development Kit (SDK). Permission is hereby granted
to use AS IS and only subject to the Alpha DFINITY Canister SDK License Agreement which
can be found here [https://sdk.dfinity.org/sdk-license-agreement.txt]. It comes with NO WARRANTY.


Do you agree and wish to install the DFINITY ALPHA SDK [y/N]?
y

info: Version found: 0.6.10
info: Creating uninstall script in ~/.cache/dfinity
info: uninstall path=/home/adel/.cache/dfinity/uninstall.sh
info: Checking for latest release...
Will install in: /home/adel/bin
info: Installed /home/adel/bin/dfx

adel@adel-VirtualBox:~$ dfx --version

Command 'dfx' not found, did you mean:

  command 'fx' from snap fx (11.1.0)
  command 'dfix' from snap dfix (0.3.5)
  command 'dx' from deb dx (1:4.4.4-12build2)
  command 'dex' from deb dex (0.8.0-2)
  command 'dfc' from deb dfc (3.1.1-1)
  command 'df' from deb coreutils (8.30-3ubuntu2)

See 'snap info <snapname>' for additional versions.

adel@adel-VirtualBox:~$ cd /bin
adel@adel-VirtualBox:/bin$ cd dfx
bash: cd: dfx: No such file or directory

以下是我的 Ubuntu 版本:

adel@adel-VirtualBox:~$ lsb_release -a

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.1 LTS
Release:    20.04
Codename:   focal

【问题讨论】:

    标签: ubuntu dfinity


    【解决方案1】:

    从 install 命令的输出看,dfx 似乎安装在 /home/adel/bin/dfx 中。你能验证一下吗:

    1. dfx 确实存在?
    test -e /home/adel/bin/dfx && echo yay found it || echo oh no
    

    如果没有,看起来好像安装失败了。

    如果是,可以直接运行:

    "$HOME/bin/dfx" --version
    
    1. 检查您的路径是否包含“/home/adel/bin”
    echo "$PATH" | tr : "\n" | grep "$HOME/bin"
    

    如果没有,您可以添加:

    echo 'export PATH="$PATH:$HOME/bin"' >> "$HOME/.bashrc"
    
    . "$HOME/.bashrc"
    
    dfx --version
    

    【讨论】:

    • Max,就像我在帖子中提到的那样;什么都没有创建,我应该更详细。我更新了我的帖子以澄清目录dfx 没有创建;我还添加了终端输出来显示这一点。
    • 我误解了脚本逻辑,并认为它会将二进制文件放入~/bin/dfx 而不是~/bin。现在一切都说得通了,而且工作正常。
    【解决方案2】:

    当我使用命令时

    dfx --version
    

    它无法识别。

    但是当我使用完整路径时它起作用了。

    sudo /home/osboxes/bin/dfx --version
    

    dfx 0.8.0

    【讨论】:

      【解决方案3】:

      我遇到了同样的问题。出于某种原因,有一个~/bin 目录,所以首先我将其删除,然后按照上一个答案进行操作:

      ubuntu@ip-172-31-81-158:~$ PATH=~/bin:$PATH
      ubuntu@ip-172-31-81-158:~$ export PATH
      ubuntu@ip-172-31-81-158:~$ sh -ci "$(curl -fsSL https://sdk.dfinity.org/install.sh)"
      info: Executing dfx install script, commit: 0a3bd5b38e498f899c8074d734116c10e0e53ca5
      info: Version found: 0.8.3
      info: Creating uninstall script in ~/.cache/dfinity
      info: uninstall path=/home/ubuntu/.cache/dfinity/uninstall.sh
      info: Checking for latest release...
      Will install in: /home/ubuntu/bin
      info: Installed /home/ubuntu/bin/dfx
      ubuntu@ip-172-31-81-158:~$ dfx --version
      dfx 0.8.3
      

      【讨论】:

      • 这并不能真正回答问题。如果您有其他问题,可以点击 进行提问。要在此问题有新答案时收到通知,您可以follow this question。一旦你有足够的reputation,你也可以add a bounty 来引起对这个问题的更多关注。 - From Review
      猜你喜欢
      • 2021-11-07
      • 2021-05-02
      • 2013-07-31
      • 2018-07-27
      • 2018-12-03
      • 2012-02-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多