diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..5b54067 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +22.16.0 diff --git a/README.md b/README.md index 0ff88f7..d85155a 100644 --- a/README.md +++ b/README.md @@ -119,10 +119,43 @@ graph TD - Lucide React (for icons) ## Installation + +### Prerequisites +This project uses Node Version Manager (nvm) to manage Node.js versions. Make sure you have nvm installed globally. + +#### Installing nvm (if not already installed) +```bash +# Install nvm +curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash + +# Reload your shell configuration +source ~/.bashrc + +# Verify nvm installation +nvm --version +``` + +### Project Setup 1. Clone the repository -2. Run `npm install` to install dependencies +2. **Quick Setup (Recommended)**: Run the setup script which handles nvm and dependencies: + ```bash + ./setup.sh + ``` + + **OR Manual Setup**: + - Use the correct Node.js version specified in `.nvmrc`: + ```bash + nvm use + ``` + If the Node.js version isn't installed, nvm will prompt you to install it: + ```bash + nvm install + ``` + - Run `npm install` to install dependencies 3. Start the development server with `npm run dev` +**Note**: The project includes a `.nvmrc` file that specifies the required Node.js version (22.16.0). Always run `nvm use` when switching to this project to ensure you're using the correct Node.js version. + ## Available Scripts - `dev`: Start development server - `build`: Build for production diff --git a/client/.nvmrc b/client/.nvmrc new file mode 100644 index 0000000..5b54067 --- /dev/null +++ b/client/.nvmrc @@ -0,0 +1 @@ +22.16.0 diff --git a/package-lock.json b/package-lock.json index ed3f35c..df48f5d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,6 +7,7 @@ "": { "name": "mcp-marketplace", "version": "0.0.0", + "hasInstallScript": true, "workspaces": [ "client", "server" diff --git a/package.json b/package.json index 6d00860..355692e 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "server" ], "scripts": { + "preinstall": "echo 'Make sure to run \"nvm use\" before installing dependencies'", "dev": "concurrently \"npm run server:dev\" \"npm run client:dev\"", "client:dev": "cd client && vite", "server:dev": "cd server && tsx watch src/server.ts", diff --git a/server/.nvmrc b/server/.nvmrc new file mode 100644 index 0000000..5b54067 --- /dev/null +++ b/server/.nvmrc @@ -0,0 +1 @@ +22.16.0 diff --git a/setup.sh b/setup.sh new file mode 100755 index 0000000..3b1f815 --- /dev/null +++ b/setup.sh @@ -0,0 +1,46 @@ +#!/bin/bash +set -e + +# MCP Agents Hub - Environment Setup Script +# This script ensures the correct Node.js version is being used via nvm + +echo "🚀 Setting up MCP Agents Hub development environment..." + +# Source nvm (in case it's not in the current shell) +export NVM_DIR="$HOME/.nvm" +[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" +[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" + +# Check if nvm is available +if ! type nvm &> /dev/null; then + echo "❌ nvm is not installed or not sourced. Please install nvm first:" + echo " curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash" + echo " source ~/.bashrc" + exit 1 +fi + +# Use the Node.js version specified in .nvmrc +if [ -f ".nvmrc" ]; then + echo "📋 Found .nvmrc file, using specified Node.js version..." + nvm use + if [ $? -ne 0 ]; then + echo "⚠️ Node.js version not installed. Installing now..." + nvm install + nvm use + fi +else + echo "⚠️ No .nvmrc file found, using default Node.js version" +fi + +# Display current versions +echo "✅ Node.js version: $(node --version)" +echo "✅ npm version: $(npm --version)" + +# Install dependencies +echo "📦 Installing dependencies..." +npm ci + +echo "🎉 Setup complete! You can now run:" +echo " npm run dev (start development server)" +echo " npm run build (build for production)" +echo " npm run lint (run linting)"