Skip to content

KIRO-M12/Vue-3-NodeJS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vue 3 + Node.js Project Setup

This README provides a comprehensive guide for setting up, managing, and troubleshooting your Vue 3 and Node.js project. Follow these steps to ensure a smooth development process.


Prerequisites

  1. Install Node.js:

    • Install Node.js (recommended: v16 LTS) from Node.js downloads.
    • Verify installation:
      node -v
      npm -v
  2. Install Git:

    • Download and install Git from Git downloads.
    • Verify installation:
      git --version
  3. Install a Package Manager:

    • Use npm (default with Node.js) or yarn:
      npm install -g yarn
  4. Install a Version Manager (Optional):

    • For Node.js version control, use:
      • nvm for Unix-based systems: nvm.
      • nvm-windows for Windows: nvm-windows.

Project Setup

1. Clone the Repository

git clone <repository_url>
cd vue-3-nodejs

2. Install Dependencies

npm install

3. Fix Compatibility Issues

Update Vulnerable Packages

  1. Audit dependencies:
    npm audit fix
  2. If critical vulnerabilities persist, run:
    npm audit fix --force

Resolve Webpack Compatibility:


Development Commands

Run the Development Server

npm run dev
  • Starts the Vue.js development server.
  • Access the app in the browser: http://localhost:5173 (default Vite port).

Lint Your Code

npm run lint
  • Fix common issues:
    npm run lint -- --fix

Build for Production

npm run build
  • Bundles the app for deployment in the /dist directory.

Preview the Build

npm run preview
  • Serve the production build locally.

Common Issues & Fixes

1. Dependency Errors (ERESOLVE)

  • Use --legacy-peer-deps to resolve conflicts:
    npm install --legacy-peer-deps

2. Webpack Loader Errors

  • If NormalModule errors occur, ensure compatible loaders:
    npm install [email protected] --save-dev

3. Node.js Version Compatibility

  • Downgrade Node.js if needed using nvm:
    nvm install 16
    nvm use 16

Advanced Configuration

Customizing package.json

  • Review and remove duplicate dependencies.
  • Ensure consistent versions for @vue and webpack packages.
  • Example:
    "dependencies": {
      "axios": "^1.7.9",
      "express": "^4.21.2",
      "cors": "^2.8.5",
      "vue": "^3.2.47"
    },
    "devDependencies": {
      "@vitejs/plugin-vue": "^4.0.0",
      "eslint": "^8.50.0",
      "vite": "^4.4.0"
    }

Updating Webpack (Optional for Legacy Builds)

  1. For Webpack 4:
    npm install [email protected] --save-dev
  2. For Webpack 5:
    npm install [email protected] --save-dev

Next Steps

  1. Set up CI/CD pipelines for deployment.
  2. Integrate unit testing with Jest or Vitest.
  3. Optimize production builds with additional Vite plugins.
  4. Document custom configurations for future maintainers.

Changelog

  • Initial setup with Vue 3 and Node.js.
  • Dependencies updated for security and compatibility.
  • Configured ESLint and Vite.

Contributors

  • KIRO-M12 - Project Owner/Developer.

For questions or issues, feel free to contact via [GitHub Issues](<repository_url>/issues).

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published