1. Visit the official website ( https://nodejs.org/en ), download and install nodejs:
then click next all the way until the installation is complete, and the environment variables have been added automatically:
Change the address of the local warehouse by setting environment variables:
You can see that it was originally in the C directory, but now it has been moved to D.
Configure the mirror site:
npm config set registry=http://registry.npm.taobao.org
Use the npm list command to see the configuration information just set:
where are these configurations written locally? Here: C:\Users\Administrator.npmrc, where the three lines of records just set are saved. The query command is as follows:
npm config get registry
npm config get prefix
npm config get cache
> npm info vue
[email protected] | MIT | deps: 5 | versions: 431
The progressive JavaScript framework for building modern web UI.
https://github.com/vuejs/core/tree/main/packages/vue#readme
keywords: vue
dist
.tarball: https://registry.npmmirror.com/vue/-/vue-3.2.47.tgz
.shasum: ......太长后面的都省略了
At this time, you can use npm to install the module, first upgrade npm to the latest version:
> npm -v
9.5.1
> npm install npm -g
added 1 package in 7s
18 packages are looking for funding
run `npm fund` for details
> npm -v
9.6.4
-g means that we install the latest npm package manager into npm config get global
the corresponding node_modules directory, and add a new system environment variable to ensure that other packages can also be installed in this directory:
Next, npm install 需要安装的模块名 -g
we will install them in this directory:
2. Install vue
We have already installed vue, here are two other modules:
npm install vue -g
npm install vue-router -g
npm install vue-cli -g
Add this path D:\Program Files\nodejs\node_global
to the system environment variable PATH, and restart CMD to take effect.
Initialize a webpack project:
vue init webpack vue-demo
If the error can be installed offline, you can refer to this article ( vue-cli Failed to download repo vuejs-templates/webpack connection timeout solution )
Finally run, start the project according to the prompt
cd vue-demo
npm run dev
The web page shows:
Alright, let’s go here first.