云主机CentOS 7新环境命令行搭建node工程步骤

1.用Node官网提供的命令安装node https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions

  步骤a.  curl --silent --location https://rpm.nodesource.com/setup_6.x sudo bash -

  步骤b.  sudo yum -y install nodejs

2.切换npm镜像源

 步骤a.  npm config set registry https://registry.npm.taobao.org --global

 步骤b.  npm config set disturl https://npm.taobao.org/dist --global

3.这步可省略,只是举个例子

 touch hello.js 创建一个新js文件,vi hello.js 输入i进入编辑模式,编辑为console.log('hello world'),ESC进入命令行模式,输入:wq保存退出vi, node hello.js,输出hello world。

猜你喜欢

转载自www.cnblogs.com/zhansu/p/9129983.html