更新时间:2023-09-09 23:04:10
对此进行了更多研究.
nodejs
安装程序使用/usr/local/bin
,对于从Finder启动的应用程序,/usr/local/bin
不包含在PATH
中:
The nodejs
installer uses /usr/local/bin
, which is not included in the PATH
for applications launched from Finder:
/usr/bin:/bin:/usr/sbin:/sbin
通过/etc/profile
和/etc/profile
,该目录包含在为bash
设置的PATH
中. path_helper :
The directory is included in the PATH
set for bash
via /etc/profile
& path_helper:
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
选项:
只需编写/usr/local/bin/node
而不是node
.
通过environment
属性调整NSTask
使用的PATH
.
使用 setenv 将PATH
更改为system
-也将影响NSTask
.
Use setenv to change the PATH
for system
— will also affect NSTask
.