Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.2k views
in Technique[技术] by (71.8m points)

vscode报错/bin/sh: dart: command not found,添加环境无效,如何解决?

问题描述

学习flutter,安装了flutter SDK,准备先用vscode熟悉一下dart语法(我也不打算单独安装dart SDK),我看了一些博客,在vscode的终端进行了配置。
export PATH=/usr/local/bin/flutter/bin/cache/dart-sdk:$PATH
之后输入dart --version也能够显示版本。
image
但是运行之后还是有报错:/bin/sh: dart: command not found
重启再配置再运行也试过了无效。

相关代码

dart的demo,夭折在hello world太扎心了:

main(){
  print("hello world");
}

我就是想知道怎么能让dart运行起来,谢谢大家的围观和建议!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

你终端里 export 没用啊,只在当前会话中生效,脚本看不到的,得写到 .bashrc 之类的资源文件里


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...