在 mac 终端上找不到 jsx 命令

编程入门 行业动态 更新时间:2024-10-24 08:29:55
本文介绍了在 mac 终端上找不到 jsx 命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

问题:

  • 我从 macintosh 终端执行以下命令:

  • I execute the following command from the macintosh terminal:

$ jsx --watch src/ build/

  • 我从终端收到以下输出错误:

  • I recieve the following output error from the terminal:

    -bash: jsx: command not found

  • 相关信息:

    • 我正在学习以下教程:facebook.github.io/react/docs/getting-started.html
    • 我从教程中执行了以下命令,输出为正:

    • I am following the following tutorial: facebook.github.io/react/docs/getting-started.html
    • I executed the following command from the tutorial with positive output:

    $ npm install -g react-tools

  • 这条指令紧跟在产生错误的指令之前:

  • This instruction immediately precedes the instruction that produces the error:

    环境信息:

    $ node -v v0.12.4 $ npm 2.10.1

    谷歌精选:

    • groups.google/forum/#!topic/reactjs/TUBkgptg2dM

    附加说明:

    • Best of google 很短,因为提供教程所提供信息的链接并不多.这样做的结果是,我认为有一个明显的解决方案,而我只是愚蠢.

    • Best of google is short because there aren't many links that provide information that the tutorial provides. A result of this is that I think there is an obvious solution and that I am just being dumb.

    如果需要,我会提供更多信息

    I will provide more information if requested

    解决方案我的独特问题:

    • 执行以下命令:

    • Execute the following command:

    $ export PATH=$PATH:$(npm config get prefix)/bin

  • 原问题命令:

  • Original problem command:

    $ jsx --watch src/ build/

  • 新的正输出:

  • New positive output:

    built Module("helloworld") ["helloworld"]

  • 推荐答案

    运行:

    npm config get prefix

    这将为您提供有关全局 npm 模块安装位置的线索.您需要将上述返回的目录下的bin目录添加到您的路径中.例如,它可能会返回/usr/local,在这种情况下,您应该将/usr/local/bin 添加到您的 PATH 中.你可以这样做:

    that will give you a clue as to where your global npm modules are installed. you need to add the bin directory under the directory returned by the above to your path. for example, it might return /usr/local, in which case you should add /usr/local/bin to your PATH. You could just do:

    export PATH=$PATH:$(npm config get prefix)/bin

    更多推荐

    在 mac 终端上找不到 jsx 命令

    本文发布于:2023-10-13 10:28:33,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1487700.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:找不到   终端   命令   mac   jsx

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!