我下载了flutter SDK,并设置了可操作的环境,以便可以使用 flutter 命令。在Windows命令提示符下,它运行良好,但我使用WSL。因此,当我启动命令提示符时,我总是启动 bash 命令以切换到linux环境。但是在那里,“ flutter”命令不起作用,我知道这是正常的。
它显示:
/mnt/c/Users/Kamel/flutter/bin/flutter: line 5: $'\r': command not found
/mnt/c/Users/Kamel/flutter/bin/flutter: line 6: $'\r': command not found
/mnt/c/Users/Kamel/flutter/bin/flutter: line 14: $'\r': command not found
: invalid optionel/flutter/bin/flutter: line 15: set: -
set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]
/mnt/c/Users/Kamel/flutter/bin/flutter: line 16: $'\r': command not found
': not a valid identifierr/bin/flutter: line 17: unset: `CDPATH
/mnt/c/Users/Kamel/flutter/bin/flutter: line 18: $'\r': command not found
/mnt/c/Users/Kamel/flutter/bin/flutter: line 19: syntax error near unexpected token `$'{\r''
'mnt/c/Users/Kamel/flutter/bin/flutter: line 19: `function follow_links() {
所以我想知道是否存在使用Windows在WSL上的命令的方法?我真的必须在WSL上安装所有内容吗?他们之间不可能建立联系吗?
谢谢!
答案 0 :(得分:2)
从您的问题中我可以理解,您已经为Windows安装了flutter,并尝试从Ubuntu(WSL)访问它,这是错误的。它们完全不同。
您需要首先在WSL中安装flutter,请查看官方文档here