zoukankan      html  css  js  c++  java
  • 【mac环境】zsh: command not found:

    近段时间从window换到mac系统,随之而来的问题接踵而来:全局安装了yarn、webpack等全局包,从开始没权限到安装成功,以为成功了,但是一执行yarn等相关命令却报 zsh: command not found: xx,到网上看了n多教程,终于尝试n次成功了,如果你试了网上n多教程没用,看看这篇比较详细又简单的教程,说不定能帮到你:
    MAC bookPro出现zsh: command not found: xxx解决方法:

    把 bash shell 中.bash_profile 全部环境变量加入zsh shell里就好

    step1:

    Term执行

    open .zshrc

    step2:

    在弹出的编辑器最下面

    加入

    source ~/.bash_profile

    或者

    source .bash_profile

    看哪个奏效,这一步就在zshrc执行时将 .bash_profile 全部环境变量加入zsh shell了

    保存

    step3:

    terminal执行

    source .zshrc              更新配置

    如果到此你已经解决了问题,那恭喜你了,可题主我就没这么幸运,我在terminal执行source .zshrc时报找不到bash_profile,坑爹的有些mac就是没有bash_profile这个文件,需要手动新建,如果你也是这样请继续跟我操作

    step:1

    terminal执行

    touch .bash_profile         创建.bash_profile

    这时候就有了bash_profile这个文件,当然是没有内容的空文件,这里又需要你写入path,我接下来是这么操作的

    step:2

    创建global安装任务的目录

    mkdir ~/.npm-global

    step:3

    配置npm全局下载时,下载到新的地址目录

    npm config set prefix '~/.npm-global'

    至此你再npm i xxx -g就会存储到npm-global的地址下了

    step:4

    open .bash_profile

    在弹出的编辑器中增加配置

    export PATH=~/.npm-global/bin:${PATH}

    保存

    step:5

    terminal执行

    source .bash_profile    更新配置

    至此解决问题

    出处:https://www.jianshu.com/p/64c175476acc。

  • 相关阅读:
    Spring Security
    用过sessionid防钓鱼
    request获取json
    相对于Statement,PreparedStatement的优点是什么?
    jquery中$.get()提交和$.post()提交有区别吗?
    相对于Statement,PreparedStatement的优点是什么?
    什么是Redis?
    如何解决表单提交的中文乱码问题
    execute,executeQuery,executeUpdate的区别是什么?
    根据你以往的经验简单叙述一下MYSQL的优化
  • 原文地址:https://www.cnblogs.com/byyoki/p/14024745.html
Copyright © 2011-2022 走看看