web123456

VSCODE build local server - running ajax

Preface.

In the recent study of jq, it involvesAJAXof knowledge in the use ofVSCODEWhen I ran it, it always reported an error. Then I realized that it needs to be paired with a local server to run. So I wrote the article.

First we need to install live sever, see the tutorial below.

图片

Type live hereserver Download and install

在这里插入图片描述

在这里插入图片描述

Next we need to open the console:

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

Well, I'm sure that when you see this, you will use the commands according to what you find on the internet, only to find out that the configuration is still unsuccessful. So let me we do some preparation before entering the command:

1. set vscode to run as administrator

在这里插入图片描述

2. PutpowershellBoot as administrator and setup with commands

在这里插入图片描述

command: set-ExecutionPolicy RemoteSigned
在这里插入图片描述

3. go to the official website to download nodejs, and configure environment variables

Here the answer will not write download tutorial. Directly go to the official website to download on the line. The following write with environment variables
在这里插入图片描述
在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

Note that the value of the variable here to write your installation of nodejs after the file path, you can directly find the installation location to copy over.

在这里插入图片描述

Once the above is done, you can enter commands and build without any problems

Enter the following command in the console.

npm install -g live-server
在这里插入图片描述

Enter the following command.

live-server
在这里插入图片描述

Finally it's ready to run.

在这里插入图片描述
在这里插入图片描述

This configured it successfully. You may want to try it in case it works.