Mac command not found

记录一些 Mac上遇到一些问题:

电脑更新后,不知道怎么环境出现了一些问题, 想安装serve,自己打包后,启动服务,但是npm i serve -g ,就是报 command not found

source ~/.bash_profile 保存环境变量后没有生效

原因:zsh和bash有别, zsh模式不执行上述脚本,bash模式才执行

zsh、bash 模式互相切换

切换bash chsh -s /bin/bash

切换zsh chsh -s /bin/zsh

1、切换到bash

2、vim ~/.bash_profile

:wq

3、source ~/.bash_profile

1、进入主目录cd ~

2、显示隐藏文件,找到. bash_profile文件夹 ls -a(如果没有可以只直接创建)

3、编辑文件 **sudo vim .**bash_profile

4、按i进入编辑模式,加入source ~/.bash_profile后,esc

5、:wq保存退出

相关推荐
凤山老林11 小时前
在 Apple 芯片的 Mac 上通过 VMware Fusion 使用 Windows 11
windows·macos·vmware·虚拟机
c&0xff0014 小时前
mac通过网线连接树莓派
macos
孙启超18 小时前
Token太贵自己写了一个mac版开源AI编程工具
人工智能·macos·开源·llm·agent·ai编程·ai应用开发
2601_9657984719 小时前
Launch Your Wellness App Fast: The Truth About Meditation Source Code
前端·macos·ios·objective-c·cocoa
2501_915909062 天前
全面解析iOS应用上架到App Store的完整流程与关键注意事项
android·macos·ios·小程序·uni-app·cocoa·iphone
2501_915918413 天前
免 Xcode 开发 iOS,工具链替代方案与编译、签名、安装
ide·vscode·macos·ios·个人开发·xcode·敏捷流程
Architect_Lee3 天前
mac安装多个tomcat
macos
ty_xiumud3 天前
以太网 MAC 详解:帧格式、位序、FCS 与收发流程
开发语言·macos·php
营养充电站3 天前
C++23 新特性在 CLion 中的实战体验
macos·docker·jupyter·正则表达式