本文介绍了create-react-app当前不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经跑过npm install create-react-app -g然后

create-react-app hello-world

返回

-bash: create-react-app: command not found

我知道我的$PATH当前被搞砸了.这是echo $PATH

I understand that my $PATH is currently messed up. Here's what is returned from echo $PATH

/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin

我真的不知道将其设置为什么,因为我目前对终端机还很陌生.任何帮助将不胜感激.谢谢!

I really don't know what to set this as, as I'm currently very new to the terminal. Any help would be greatly appreciated. Thank you!

推荐答案

只需将路径导出到.bashrc,然后从$ home目录中的.profile文件全部调用它,然后重新启动.例如:.bashrc文件:

Just export path to .bashrc and then call it from .profile file all in $Home directory then restart. e.g:.bashrc file:

export PATH=$HOME/node_modules/.bin/:$PATH

.profile文件:

.profile file:

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
       . "$HOME/.bashrc"
    fi
fi

 # set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

这篇关于create-react-app当前不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 21:36