Prepare the environment

1. Install nodeJS + NPM

  • Download the nodeJS file from the nodejs website and install the file to the corresponding location in sequence

Since nodeJS is already integrated with NPM, there is no need to download it separately from nodeJS + NPM

$ node -v  
$ npm -v
Copy the code

Above check whether local installation is complete, as shown below:

  • Create the node_global and node_cache folders to prevent NPM installation dependencies from piling up on the default disk

Because the default NPM download dependency installation path is in the ‘C:\Users\ Your own computer name \AppData\Roaming\ NPM ‘path, so we will change this location

1. In the directory where nodeJS is installed, create the above two folders, as shown below:

2. Configure global environment variables

User variable: Edit PATH and add ‘C:\Program Files\nodejs\node_global’. System variable: Create a new variable named NODE_PATH and value ‘C:\Program Files\nodejs\node_modules’.

3. Run the command

$ npm config set prefix "C:\Program Files\nodejs\node_global"  
$ npm config set cache "C:\Program Files\nodejs\node_cache"
Copy the code

Finally, the installation path of NPM will change.

2. The Git installed

Download a stable version from Git’s official website and mindlessly click Next to install. Git address

$ git version
Copy the code

Above check whether local installation is complete, as shown below:

Begin to build

1. Build the Hexo website

  • Download scaffolding
# global install
$ npm install hexo-cli -g
# View the hexo version
$ hexo -v

The installation succeededHexo - CLI: 4.3.0 OS: win32 10.0.18363 node: 14.18.1 V8:8.4.371.23-node.84 UV: 1.42.0 zlib: 1.2.11 brotli: 1.0.9 ares: hexo- CLI: 4.3.0 OS: Win32 10.0.18363 node: 14.18.1 V8:8.4.371.23-node.84 UV: 1.42.0 zlib: 1.2.11 brotli: 1.0.9 ares: 1.17.2 modules: 83 nghttp2:1.42.0 nAPI: 8 LLHTTP: 2.1.4 Openssl: 1.1.1L CLDR: 39.0 ICU: 69.1 tz: 2021a Unicode: 13.0Copy the code
  • Initialize the project
$hexo init Project name# initialization

found 0 vulnerabilities
INFO  Start blogging with Hexo! # Install successfully

$ cdThe project name# enter directory
$ npm install # installation NPM
$ hexo server # start service

INFO  Hexo is running at http://localhost:4000 . Press Ctrl+C to stop. # Deploy successfully

Copy the code

The diagram below:

2. Deploy the site to Gitee

  • Create account

This step can be skipped, ha ha.

  • The new warehouse

The warehouse name and the warehouse path should be as consistent as possible.

  • Configure SSH
$ git config --global user.name "" # gitee username
$ git config --global user.email ""  # mailbox
Create SSH public key and add it to Gitee to implement password-free login
# 1. Generate a public key
ssh-keygen -t rsa -C "# mailbox" 
Copy the code

In the directory C:\Users\ hostname. SSH, copy the information in the key name. Pub to gitee’s SSH public key

  • Configuration gitee pages

Enter the warehouse, click management options, click options to initialize readme. md quickly open SVN access, then click Services, select Gitee Pages, if this is the first operation, you need to upload id card for verification, and then wait a day to return to this interface operation.

Then follow the following figure:

  • Configure the _config.yml file for the project
  1. Change the Gitee Pages address in the URL
  2. The language can be Changed to Chinese language: zh-CN
  3. Change deploy to the address of Gitee Pages

The diagram below:

  • Deployment project
$ cdThe project nameEnter the project directory
$ hexo clean # clear cache
$ hexo g Generate site files
$ hexo s # Local test code, Ctrl+ C stop local mapping
$ hexo d # Push local code to code cloud, the first push needs to enter gitee account password
Copy the code

Note that each time you deploy a project, you click Update in Gitee Pages

3. Fluid theme

Create a fluid configuration file that permanently overwrites the _config.yml file

Change the configuration of _config.yml to find the theme and specify the theme as fluid

Create a _config.fluid. Yml file in the same directory as _config.yml and copy the contents directly from here

And then you reboot, and you’re done.

To continue editing or writing articles, click here

Problems encountered

Vscode’s terminal cannot execute the hexo command

  1. Run Power Shell as an administrator

(Note: Right-click win and choose Windows PowerShell(Administrator) to open it.) 2. Enter set-executionPolicy RemoteSigned enter 3. Type A or Y and press Enter

Hexo deployment Error Err: Error: Spawn failed Solution

Go to the project root directory
cdThe project name## Delete git commit folder
rm -rf .deploy_git/

# # to perform
git config --global core.autocrlf false

# # the last
hexo clean && hexo g && hexo d
Copy the code

Personal website: jasoninterface. Gitee. IO/hexo – blog /

Scan the QR code to share interesting things from time to time: