Use npm to quickly build the first vue project
Prerequisite: Make sure that node.js is installed and the corresponding environment variables are correctly configured
Enter node --version
to see if the corresponding version number information can appear
First create an empty folder and open it with vscode
Create a new terminal ( in the top bar of vscode, select the terminal, then pull down to select the new terminal ), enter npm init vue@latest
, and then configure it by default
npm init vue@latest
✔ Project name: … <your-project-name>
✔ Add TypeScript? … No / Yes
✔ Add JSX Support? … No / Yes
✔ Add Vue Router for Single Page Application development? … No / Yes
✔ Add Pinia for state management? … No / Yes
✔ Add Vitest for Unit testing? … No / Yes
✔ Add Cypress for both Unit and End-to-End testing? … No / Yes
✔ Add ESLint for code quality? … No / Yes
✔ Add Prettier for code formatting? … No / Yes
Scaffolding project in ./<your-project-name>...
Done.
Install dependencies and start the development server:
cd vue-project # 自己的项目名
npm install
npm run dev
Access from the browser (http://localhost:5173)
Relevant code:
The first vue project is built