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命令都會有效