node版本管理(centos下測試通過)

安裝nodejs

sudo yum install nodejs

運行 node --version 發現是node6版本的,在安裝vue之類的框架之後會報錯如圖:

const wslToWindowsPath = async path => {
SyntaxError: Unexpected identifier

在這裏插入圖片描述
經過查詢,應該升級node版本,於是發現了這款node版本管理工具: https://github.com/tj/n

安裝新版本node

n latest

同時也可以使用 n + 版本號的形式安裝指定版本的nodejs

切換nodejs版本

輸入n即可進入nodejs切換模式

n

在這裏插入圖片描述

參考: https://segmentfault.com/a/1190000015302680

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章