简体   繁体   English

终端拒绝访问 flutter sdk 路径变量 .zshrc 文件

[英]Terminal is access denied of flutter sdk path variable .zshrc file

Wrote path for flutter SDK with $HOME/.zshrc and with export PATH="$PATH:/Users/prettygirl/FlutterSDK/flutter/bin"使用$HOME/.zshrcexport PATH="$PATH:/Users/prettygirl/FlutterSDK/flutter/bin"flutter SDK编写路径

It went ok and even the flutter doctor worked.一切顺利,甚至flutter doctor工作了。

Then when I close the terminal and reopen it, then it shows .zshrc permission denied , but I have given full disk access to the terminal .然后当我关闭terminal并重新打开它时,它会显示.zshrc permission denied ,但我已经给了terminal full disk access

/Users/prettygirl/.zprofile:export:1: not valid in this context: PATH:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Users/prettygirl/FlutterSDK/flutter/bin /Users/prettygirl/.zshrc:1: permission denied: /Users/prettygirl/FlutterSDK/flutter/bin

now when I run flutter doctor it says zsh: command not found: flutter like I never updated the SDK path.现在,当我运行flutter doctor它说zsh: command not found: flutter就像我从未更新过 SDK 路径一样。

Opened .zshrc file with a text editor and it contains the path and opens fine.a text editor打开.zshrc文件,它包含路径并且打开正常。

Why is that?这是为什么?

you need to set the SDK path in the .zshrc file您需要在 .zshrc 文件中设置 SDK 路径

open .zshrc file打开 .zshrc 文件

vim .zshrc

add a line on this file在此文件上添加一行

export PATH="$PATH:[PATH_OF_FLUTTER_GIT_DIRECTORY]/bin"

close terminal and reopen the terminal check关闭终端并重新打开终端检查

echo $path

if a path is showing then try other commands related to flutter.如果显示路径,则尝试其他与颤振相关的命令。

 flutter doctor 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM