1. Installation node. Js
Node. js official website: nodejs.org/en/
You are advised to download the stable version
2. Run vUE code
You need to install the dependency package NPM install for the first time
NPM run [config command] (see package.json for details)
2.1 Basic NPM Commands
Initialize a new project
npm init
Copy the code
Adding a dependency package
npm install [package]
npm install [package]@[version]
npm install [package]@[tag]
Copy the code
Add dependencies to different dependency categories
Add to the dependencies and devDependencies categories respectively:
npm install [package]
npm install [package] --save-dev
Copy the code
Upgrading dependency packages
npm upgrade [package]
npm upgrade [package]@[version]
npm upgrade [package]@[tag]
Copy the code
Removing dependency packages
npm uninstall [package]
Copy the code
Install all dependencies of the project
npm install
Copy the code
3. Install YARN (optional based on personal requirements).
Liverpoolfc.tv: yarn.bootcss.com/
Yarnnpm install yarn -g Run project yarn run [config command]
3.1 Yarn Basic Commands
Initialize a new project
yarn init
Copy the code
Adding a dependency package
yarn add [package]
yarn add [package]@[version]
yarn add [package]@[tag]
Copy the code
Add dependencies to different dependency categories
Add to the dependencies, devDependencies, Dependencies, and optionalDependencies categories respectively:
yarn add [package]
yarn add [package] --dev
yarn add [package] --peer
yarn add [package] --optional
Copy the code
Upgrading dependency packages
yarn upgrade [package]
yarn upgrade [package]@[version]
yarn upgrade [package]@[tag]
Copy the code
Removing dependency packages
yarn remove [package]
Copy the code
Install all dependencies of the project
yarn
Copy the code
or
yarn install
Copy the code
3.2 Possible Problems During YARN Installation
Problem: YARN: Cannot load file C: Users\Administrator\AppData\Roaming\ NPM \yarn.ps1, because scripts cannot be run on this system. For more information, please refer to the about_Execution_Policies https:/go.microsoft.com/fwlink/?LinkID=135170.Copy the code
1. Go to **C:\Windows\System32\WindowsPowerShell\v1.0** and find **powershell.exe**. Right-click the file and perform operations as an administrator. 2. Right-click the file and perform operations as an administrator. 3. Run the ** set-executionPolicy RemoteSigned** command and enter the **y** option. 4. Restart vscodeCopy the code
4. Install CNPM (optional depending on personal needs)
npm install -g cnpm --registry=https://registry.npm.taobao.org
Use method: CNPM [command] (command same as NPM)