-bash: dart: command not found

作者: 跨境大师兄 | 来源:发表于2019-10-03 16:20 被阅读0次

    今天开始学习下dart语法,新建个helloWorld.dart文件,执行dart helloWorld.dart 却报-bash: dart: command not found的错:


    dartError.png

    原因是下载Fluter SDK时,Dart SDK已经在捆绑Fluter里了,所以需要设置下Dart环境变量的路径:

    1. 打开配置环境变量的文件: .bash_profile
    1. 配置Dart SDK所在路径: export PATH=${PATH}:/Users/wdw/Desktop/cmstop_wdw/IndividualRepository/study/flutter/SDK/flutter/bin/cache/dart-sdk/bin
    1. 然后在终端里执行: source ~/.bash_profile 重新加载一下
    1. 继续执行dart helloWorld.dart ,就可以正确执行了


      dartHello.png

    相关文章

      网友评论

        本文标题:-bash: dart: command not found

        本文链接:https://www.haomeiwen.com/subject/vrbdpctx.html