ubatu 安装nodejs npm liveserver

更新ubuntu软件源sudo apt-get updatesudo apt-get install -y python-software-properties software-properties-commonsudo add-apt-repository ppa:chris-lea/node.jssudo apt-get update安装nodejssudo apt-get install nodejssudo apt install nodejs-legacysudo apt install npm更新npm的包镜像源,方便快速下载sudo npm config set registry https://registry.npm.taobao.orgsudo npm config list全局安装n管理器(用于管理nodejs版本)sudo npm install n -g安装最新的nodejs(stable版本)sudo n stablesudo node -v1:安装node.js的版本控制工具nvm,在终端中执行:安装npmsudo apt install npm安装curlsudo apt install curlcurl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash2:关闭终端后,重新进入终端,安装nodenvm install node3:安装live-server:npm install live-server4:使用live-server在前段文件中运行live-server

 

相关文章