Create vue3 project - using @vue/cli and vite

1. Installation

Install node.js and install scaffolding (npm install -g @vue/cli)

2. Create a project - use vite 

npm create vite@latest my-vue-app //my-vue-app is the project name

npm i install dependencies

npm run dev starts the service

Encountered an error:

npm ERR! Could not install from "Files\nodejs\node_cache\_npx\13472" as it does
not contain a package.json file.

Reason: Because there are spaces in the node_cache path.

solve:

Execute: npm config get cache

The result is: D:\Program Files\nodejs\node_cache

Input: npm config set cache "D:\Program~1\nodejs\node_modules\npm\node_cache" --global

3. Create a project - use vue-cli

1. Under the project file, enter the command line

vue create project name 

2. Choose to create a project manually

3. Select vue-router, vuex, css Pre-processors option

4. Select vue3.0 version

5. Select the route of hash mode

6. Select less as the preprocessor

7. Select the standard standard code style

8. Save the code to verify the code style, and verify the code style when the code is submitted

9. The configuration files that depend on plug-ins or tools are saved in separate files

10. Whether to record the above operations, select No

11. Finally, the installation is successful

Encountered an error:

npm ERR! Error: EPERM: operation not permitted, open 'C:\Program Files\nodejs\node_cache\XXX

Solution: To create a project under administrator privileges

Run as an administrator, enter the E disk
C:\Windows\system32>E:
switch to the project file
E:\>cd web-project

Guess you like

Origin blog.csdn.net/m0_63304840/article/details/127406375