Node.js V10.24.1 installation steps (node, cnpm, yarn, vue)

1. Download node.js

Download URL: Download | Node.js

To download previous releases please click "Previous Releases" 

This article takes V10.24.1 as an example to download 64-bit msi

 

 2. Installation

After the download is complete, click Next until the installation is complete, and you can modify the installation location yourself. Without going into too much detail, there are many installation tutorials.

Check node, npm version and specify global module path

# 检查node版本
node -v
# 检查npm版本
npm -v

Create new node_global and node_cache directories under the node installation root directory

Modify the global module path to node_global, and the cache path to node_cache

# 设置全局模块路径
npm config set prefix "D:\soft\nodejs\node_global"

# 设置缓存路径
npm config set cache "D:\soft\nodejs\node_cache"

Check if the configuration is correct, open the file C:\Users\Administrator\.npmrc

3. Modify system environment variables

Added the NODE_PATH system variable, which corresponds to the lower-level folder node_modules on which the global module path is set above the path.

NODE_PATH:D:\soft\nodejs\node_global\node_modules

 

Add D:\soft\nodejs\node_global to PATH path

D:\soft\nodejs\node_global

3. View and modify the mirror source address

# 查看当前镜像源
npm config get registry

# 修改为淘宝镜像源
npm config set registry https://registry.npm.taobao.org

# 修改为官方镜像源
npm config set registry http://www.npmjs.org

4. Install cnpm

Note: npm install -g cnpm -registry=https://registry.npm.taobao.org ## This command installs the latest version of cnpm by default. If the node version is lower, the installation may fail. You can specify to install a lower version cnpm .

# 先卸载 cnpm
npm uninstall -g cnpm

# 安装指定版本 cnpm
npm install [email protected] -g

# 检查版本
cnpm -v

Five, install yarn

cnpm install -g yarn
npm install -g yarn

Change the module and cache storage directory
First create the yarn_global and yarn_cache folders in the yarn installation directory, and open the command window to execute the following commands.

# 全局安装目录
yarn config set global-folder D:\soft\nodejs\node_global\node_modules\yarn\yarn_global

# 缓存目录
yarn config set cache-folder D:\soft\nodejs\node_global\node_modules\yarn\yarn_cache

6. Install VUE Scaffolding

安装 vue-cli脚手架
cnpm install -g @vue/cli
npm install -g @vue/cli

安装vue-cli-init 项目初始化工具
cnpm install -g @vue/cli-init
npm install -g @vue/cli-init

Guess you like

Origin blog.csdn.net/ShenDaiSun/article/details/130975782