〜/ zshrc:权限被拒绝

时间:2020-04-14 03:57:44

标签: react-native expo zsh

我已经安装了expo CLI,并试图使用expo init来启动一个项目。当我这样做时,将返回:

bash: expo: command not found

我看到这需要用.bash_profile更新export PATH=$PATH:~/node_modules

但是,显然Mac OS Catalina从.bash_profile切换到了zprofile或zshrc。在线建议说,应该改为在{{sh}}的末尾添加PATH=$PATH:~/node_modules

我尝试这样做,但是它说文件已锁定。当我尝试对其进行编辑时,会弹出:

您没有文件“ zshrc”,也没有写权限。

有什么想法可以解决这个问题吗?

P.S。不久前,我安装了anaconda,发现.bash_profile具有以下功能:

# added by Anaconda3 5.0.1 installer
export PATH="~/anaconda3/bin:$PATH"

# Setting PATH for Python 3.6

# The original version is saved in .bash_profile.pysave
PATH="~/Frameworks/Python.framework/Versions/3.6/bin:${PATH}"
export PATH

这可能是个问题吗?我使用新路径更新了文件,但仍无法识别expo。那是我发现Catalina切换到zprofile和zshrc的时候。

我已经坚持了很长时间,尝试了很多方法-任何建议将不胜感激!

1 个答案:

答案 0 :(得分:0)

如果您未使用ZSH,则您将获得zsh: command not found: expo。您可以使用chsh切换到使用zsh,也可以继续使用Bash。

然后,您应该通过运行.bash_profile.zshenv将PATH修改(导出PATH ...)添加到适当的外壳配置文件sudo vim ~/.bash_profilesudo vim ~/.zshenv中,或者如果您使用VSCode,则sudo code ~/.zshrc