[英]“-bash: expo: command not found” after installing expo-cli
I've just installed expo-cli with npm install -g expo-cli
, but if I try and run an expo command, I just get the error -bash: expo: command not found
.我刚刚使用
npm install -g expo-cli
,但是如果我尝试运行 expo 命令,我只会收到错误-bash: expo: command not found
I've tried uninstalling and reinstalling expo-cli, and changing my.profile and.bash_profile to add the path to the global node_modules directory, but I just can't get expo commands working.我尝试卸载并重新安装 expo-cli,并更改 my.profile 和 .bash_profile 以将路径添加到全局 node_modules 目录,但我无法让 expo 命令正常工作。 Any idea why?
知道为什么吗?
1st I enabled the finder to show hidden files by writing following commands:首先,我通过编写以下命令使查找器显示隐藏文件:
defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder
Then I searched for the expo files under my user:然后我在我的用户下搜索了 expo 文件:
macintoch HD>Users>MyUserName>
I found the expo file under the following folder:我在以下文件夹下找到了 expo 文件:
~/Users/MyUserName/.npm-globalHomebrew/bin
Then I added the folder in the Path by executing the following commands:然后我通过执行以下命令将文件夹添加到路径中:
export PATH=$PATH:~/.npm-globalHomebrew/bin
I checked if it is added successfully by typing the following command:我通过键入以下命令检查它是否添加成功:
echo $PATH
Run then the following commands to login to expo:然后运行以下命令登录到 expo:
expo login
expo whoami
For any expo
command, try running:对于任何
expo
命令,请尝试运行:
$ npx expo <your command(s) here>
Using the command above solved the -bash: expo: command not found
error for me.使用上面的命令解决了我的
-bash: expo: command not found
错误。
( $
denotes the terminal prompt) (
$
表示终端提示符)
I also ran npm install -g expo-cli
before running my command above.在运行上面的命令之前,我还运行了
npm install -g expo-cli
。
Use this用这个
sudo npm install --unsafe-perm -g expo-cli
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.