gpt4 book ai didi

macos - zsh : command not found: react-native - MacOS

转载 作者:行者123 更新时间:2023-12-04 14:21:13 24 4
gpt4 key购买 nike

我正在尝试启动 react-native 但出现以下错误 zsh: command not found: react-native当我写 react-native init firstApp.

我尝试了以下指南: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 <<<?
行下方吗?

最佳答案

解决了!

步骤:

  1. 运行 npm list -g |头-n 1

它会给你一个类似于/类似于以下的路径:/Users/{YOUR_USER_NAME}/.npm-packages/lib

  1. 通过将 /lib 替换为 /bin:$PATH 来更改该路径,以便您获得:/Users/cisco/.npm-packages/bin:$PATH

  2. 运行 export PATH="/Users/{YOUR_USER_NAME}/.npm-packages/bin:$PATH"

关于macos - zsh : command not found: react-native - MacOS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54650443/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com