在mac下安装jdk之后,在命令行中执行node -v, npm i 等命令会出现command not found;
解决办法:

第一步:创建.bash_profile文件,~表示在~目录下,.表示隐藏文件,打开终端,输入命令如下

touch ~/.bash_profile

第二步:打开.bash_profile文件,输入命令如下:

open -t ~/.bash_profile

第三步:这时候会弹出一个空白的文本编辑框,在文本编辑框里面第一行编辑:

export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
command + s保存文件。

第四步:保存.bash_profile文件,输入命令:

source .bash_profile

第五步:再输入npm -v 或者node -v 就能看到版本号啦~

相关文章:

  • 2021-07-18
  • 2021-11-22
  • 2022-12-23
  • 2022-02-14
  • 2022-12-23
  • 2022-12-23
  • 2021-12-24
猜你喜欢
  • 2022-01-10
  • 2021-09-27
  • 2022-01-17
  • 2021-07-13
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案