nvm command errors All In One
errors
nvm can not change the default alias node.js version ❌
$ nvm install 18.20.4
# current use
$ nvm use 18.20.4
# set default, but not use default ❌
$ nvm alias default 18.20.4
solutions
# use default ✅
$ nvm use default
Now using node v18.20.4 (npm v10.7.0)
demos
# set default ✅
$ nvm alias default 18.20.4
# use default ✅
$ nvm use default
(🐞 反爬蟲測試!打擊盜版⚠️)如果你看到這個資訊, 說明這是一篇剽竊的文章,請訪問 https://www.cnblogs.com/xgqfrms/ 檢視原創文章!
NVM
$ nvm ls
$ nvm ls-remote | grep "Latest LTS"
v4.9.1 (Latest LTS: Argon)
v6.17.1 (Latest LTS: Boron)
v8.17.0 (Latest LTS: Carbon)
v10.24.1 (Latest LTS: Dubnium)
v12.22.12 (Latest LTS: Erbium)
v14.21.3 (Latest LTS: Fermium)
v16.20.2 (Latest LTS: Gallium)
v18.20.4 (Latest LTS: Hydrogen)
v20.18.0 (Latest LTS: Iron)
$ node -v
v18.12.0
$ nvm -h
Node Version Manager (v0.35.2)
# ...
nvm uninstall <version> Uninstall a version
nvm uninstall --lts Uninstall using automatic LTS (long-term support) alias `lts/*`, if available.
nvm uninstall --lts=<LTS name> Uninstall using automatic alias for provided LTS line, if available.
# ...
nvm alias <name> <version> Set an alias named <name> pointing to <version>
nvm unalias <name> Deletes the alias named <name>
Example:
nvm install 8.0.0 Install a specific version number
nvm use 8.0 Use the latest available 8.0.x release
nvm run 6.10.3 app.js Run app.js using node 6.10.3
nvm exec 4.8.3 node app.js Run `node app.js` with the PATH pointing to node 4.8.3
nvm alias default 8.1.0 Set default node version on a shell
nvm alias default node Always default to the latest available node version on a shell
Note:
to remove, delete, or uninstall nvm - just remove the `$NVM_DIR` folder (usually `~/.nvm`)
$ nvm install 18.20.4
$ nvm use 18.20.4
$ nvm alias default 18.20.4
$ ls -al ~/.nvm/versions/node
total 16
drwxr-xr-x 8 xgqfrms-mm staff 256 Oct 17 15:41 .
drwxr-xr-x 3 xgqfrms-mm staff 96 Dec 24 2019 ..
-rw-r--r--@ 1 xgqfrms-mm staff 6148 Dec 19 2022 .DS_Store
drwxr-xr-x 9 xgqfrms-mm staff 288 Dec 24 2019 v10.15.3
drwxr-xr-x 9 xgqfrms-mm staff 288 Oct 27 2022 v16.18.0
drwxr-xr-x 10 xgqfrms-mm staff 320 Dec 19 2022 v18.12.0
drwxr-xr-x 9 xgqfrms-mm staff 288 May 29 2023 v18.16.0
drwxr-xr-x 9 xgqfrms-mm staff 288 Oct 17 15:41 v18.20.4
refs
https://dev.to/smpnjn/setting-the-default-nodejs-version-with-nvm-54c3
https://stackoverflow.com/a/47787025/5934465
©xgqfrms 2012-2021
www.cnblogs.com/xgqfrms 釋出文章使用:只允許註冊使用者才可以訪問!
原創文章,版權所有©️xgqfrms, 禁止轉載 🈲️,侵權必究⚠️!