【发布时间】:2023-03-04 09:28:01
【问题描述】:
我正在尝试启动 react-native,但是当我写 react-native init firstApp 时出现以下错误 zsh: command not found: react-native
.
我尝试了以下指南:react-native: command not found
但我有两个主要问题:
第一 我不明白使用/导出哪个路径
这里已经安装了 React-native:
/Users/cisco/.npm-packages/bin/react-native -> /Users/cisco/.npm-packages/lib/node_modules/react-native/local-cli/wrong-react-native.js
第二
在指南中它被写入运行:
export PATH="/usr/local/Cellar/node/6.1.0/libexec/npm/bin:$PATH"
react-native init appName
cd appName
react-native run-ios
我不知道怎么做:
1)export PATH=之后写什么
2) 我应该在某处添加我的路径吗?如果是,我该怎么做?
我尝试运行touch ~/.bash_profile; open ~/.bash_profile 来添加我的路径。
里面有:
# added by Anaconda3 5.3.1 installer
# >>> conda init >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$(CONDA_REPORT_ERRORS=false '/anaconda3/bin/conda' shell.bash hook 2> /dev/null)"
if [ $? -eq 0 ]; then
\eval "$__conda_setup"
else
if [ -f "/anaconda3/etc/profile.d/conda.sh" ]; then
. "/anaconda3/etc/profile.d/conda.sh"
CONDA_CHANGEPS1=false conda activate base
else
\export PATH="/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda init <<<
# added by Anaconda3 2018.12 installer
# >>> conda init >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$(CONDA_REPORT_ERRORS=false '/Users/cisco/anaconda3/bin/conda' shell.bash hook 2> /dev/null)"
if [ $? -eq 0 ]; then
\eval "$__conda_setup"
else
if [ -f "/Users/cisco/anaconda3/etc/profile.d/conda.sh" ]; then
. "/Users/cisco/anaconda3/etc/profile.d/conda.sh"
CONDA_CHANGEPS1=false conda activate base
else
\export PATH="/Users/cisco/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda init <<<
一旦你帮我确定了正确的添加路径,我可以简单地将它添加到# <<< conda init <<<?
行下面的文件中
【问题讨论】:
-
您是否尝试为 react-native 提供完整路径
-
你安装了 react-native-cli -
npm install -g react-native-cli? -
是的,我确实安装了
npm install -g react-native-cli -
好吧,
sudo npm install -g react-native-cli为我完成了这项工作。
标签: macos react-native