Using a release binary (Linux/macOS/Windows)
- Download the latest release binary for your system
- Make it available globally on
PATH
environment variable - Configure your shell profile:
-
PowerShell
Add the following to the end of your profile file:
fnm env --use-on-cd | Out-String | Invoke-Expression
- On Windows, the profile is located at
~\Documents\PowerShell\Microsoft.PowerShell_profile.ps1
or$PROFILE
- For macOS/Linux, the profile is located at
~/.config/powershell/Microsoft.PowerShell_profile.ps1
1.下载fnm.exe,放入D盘,将其目录加入环境变量path中
2.使用powershell来执行fnm命令
3.安装完node版本后,查看是否成功时,如果node -v命令无效,需要执行 “fnm env --use-on-cd | Out-String | Invoke-Expression”
4.为了后续打开powershell执行node命令永远有效,需要下面操作
a.打开powershell,输入“$profile”,会输出一个配置文件路径
b.按照文件路径打开该文件,如果没有该文件则创建一个,输入“fnm env --use-on-cd | Out-String | Invoke-Expression” 并保存
后续打开powershell,node命令都会有效