记录解决:zsh: command not found: tsc

3,308 阅读1分钟

背景

Mac安装typeScript后,使用tsc命令报错zsh: command not found: tsc原因是zsh和bash的默认环境变量配置文件地址不一致。

解决

  1. 执行cd ~/
  2. 执行touch .bash_profile 创建.bash_profile
  3. 执行open .bash_profile 打开.bash_profile
  4. 在.bash_profile 文件中加入自己的环境变量配置文件地址export PATH="/usr/local/lib/node_modules/typescript/bin/,并按command+s进行保存。
  5. 执行source .bash_profile 使配置生效。

结果

经过上述操作之后,再执行控制台就可以看到tsc命令有作用了。

截屏2021-09-02 下午3.21.32.png