environment-setup-guide by sickn33/antigravity-awesome-skills
npx skills add https://github.com/sickn33/antigravity-awesome-skills --skill environment-setup-guide帮助开发者从零开始搭建完整的开发环境。本技能提供分步指导,涵盖安装工具、配置依赖项、设置环境变量以及验证设置是否正常工作。
我将帮助您确定需要安装的内容:
在安装任何内容之前,我将帮助您检查已安装的内容:
# 检查已安装工具的版本
node --version
python --version
git --version
docker --version
我将提供特定于平台的安装命令:
帮助设置:
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
提供验证步骤以确保一切正常:
## 设置 Node.js 开发环境
### 先决条件
- macOS、Linux 或 Windows
- 终端/命令提示符访问权限
- 网络连接
### 步骤 1:安装 Node.js
**macOS(使用 Homebrew):**
```bash
# 如果未安装 Homebrew,则安装
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# 安装 Node.js
brew install node
Linux(Ubuntu/Debian):
# 更新软件包列表
sudo apt update
# 安装 Node.js 和 npm
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install -y nodejs
Windows(使用 Chocolatey):
# 如果未安装 Chocolatey,则安装
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
# 安装 Node.js
choco install nodejs
node --version # 应显示 v20.x.x 或更高版本
npm --version # 应显示 10.x.x 或更高版本
# 克隆仓库
git clone https://github.com/your-repo/project.git
cd project
# 安装依赖项
npm install
创建一个 .env 文件:
# 复制示例环境文件
cp .env.example .env
# 使用您的值进行编辑
nano .env
示例 .env 内容:
NODE_ENV=development
PORT=3000
DATABASE_URL=postgresql://localhost:5432/mydb
API_KEY=your-api-key-here
# 启动开发服务器
npm run dev
# 应看到:Server running on http://localhost:3000
问题: "node: command not found"
解决方案: 重启终端或运行 source ~/.bashrc(Linux)或 source ~/.zshrc(macOS)
问题: "Permission denied" 错误 解决方案: 不要将 sudo 与 npm 一起使用。修复权限:
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
### 示例 2:Python 项目设置
```markdown
## 设置 Python 开发环境
### 步骤 1:安装 Python
**macOS:**
```bash
brew install python@3.11
Linux:
sudo apt update
sudo apt install python3.11 python3.11-venv python3-pip
Windows:
choco install python --version=3.11
python3 --version # 应显示 Python 3.11.x
pip3 --version # 应显示 pip 23.x.x
# 导航到项目目录
cd my-project
# 创建虚拟环境
python3 -m venv venv
# 激活虚拟环境
# macOS/Linux:
source venv/bin/activate
# Windows:
venv\Scripts\activate
# 从 requirements.txt 安装
pip install -r requirements.txt
# 或单独安装包
pip install flask sqlalchemy python-dotenv
创建 .env 文件:
FLASK_APP=app.py
FLASK_ENV=development
DATABASE_URL=sqlite:///app.db
SECRET_KEY=your-secret-key-here
# 运行 Flask 应用
flask run
# 应看到:Running on http://127.0.0.1:5000
### 示例 3:Docker 开发环境
```markdown
## 设置 Docker 开发环境
### 步骤 1:安装 Docker
**macOS:**
```bash
brew install --cask docker
# 或从 docker.com 下载 Docker Desktop
Linux:
# 安装 Docker
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
# 将用户添加到 docker 组
sudo usermod -aG docker $USER
newgrp docker
Windows: 从 docker.com 下载 Docker Desktop
docker --version # 应显示 Docker version 24.x.x
docker-compose --version # 应显示 Docker Compose version 2.x.x
version: '3.8'
services:
app:
build: .
ports:
- "3000:3000"
environment:
- NODE_ENV=development
- DATABASE_URL=postgresql://postgres:password@db:5432/mydb
volumes:
- .:/app
- /app/node_modules
depends_on:
- db
db:
image: postgres:15
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=password
- POSTGRES_DB=mydb
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
volumes:
postgres_data:
# 构建并启动容器
docker-compose up -d
# 查看日志
docker-compose logs -f
# 停止服务
docker-compose down
# 检查正在运行的容器
docker ps
# 测试数据库连接
docker-compose exec db psql -U postgres -d mydb
## 最佳实践
### ✅ 应该这样做
* **记录所有内容** - 编写清晰的设置说明
* **使用版本管理器** - Node 用 nvm,Python 用 pyenv
* **创建 .env.example** - 显示所需的环境变量
* **在干净系统上测试** - 验证说明是否从头开始有效
* **包含故障排除** - 记录常见问题和解决方案
* **使用 Docker** - 确保跨机器环境一致
* **固定版本** - 在包文件中指定确切版本
* **自动化设置** - 尽可能创建设置脚本
* **检查先决条件** - 在开始前列出所需工具
* **提供验证步骤** - 帮助用户确认设置有效
### ❌ 不要这样做
* **不要假设工具已安装** - 始终检查并提供安装说明
* **不要跳过环境变量** - 记录所有必需的变量
* **不要将 Sudo 与 npm 一起使用** - 改为修复权限
* **不要忘记平台差异** - 提供特定于操作系统的说明
* **不要遗漏验证** - 始终包含测试步骤
* **不要使用全局安装** - 优先使用本地/虚拟环境
* **不要忽略错误** - 记录如何处理常见错误
* **不要跳过数据库设置** - 包含数据库初始化步骤
## 常见陷阱
### 问题:安装后出现 "Command not found"
**症状:** 已安装工具但终端无法识别
**解决方案:**
* 重启终端或 source shell 配置
* 检查 PATH 环境变量
* 验证安装位置
```bash
# 检查 PATH
echo $PATH
# 添加到 PATH(示例)
export PATH="/usr/local/bin:$PATH"
症状: "EACCES" 或 "Permission denied" 错误 解决方案:
# 修复 npm 权限
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
症状: "Port 3000 is already in use" 解决方案:
# 查找端口 3000 上的进程
lsof -i :3000
# 终止进程
kill -9 <PID>
# 或使用不同的端口
PORT=3001 npm start
症状: "Connection refused" 或 "Authentication failed" 解决方案:
# 检查 PostgreSQL 是否正在运行
sudo systemctl status postgresql
# 测试连接
psql -h localhost -U postgres -d mydb
创建一个 setup.sh 脚本来自动化设置:
#!/bin/bash
echo "🚀 正在设置开发环境..."
# 检查先决条件
command -v node >/dev/null 2>&1 || { echo "❌ Node.js 未安装"; exit 1; }
command -v git >/dev/null 2>&1 || { echo "❌ Git 未安装"; exit 1; }
echo "✅ 先决条件检查通过"
# 安装依赖项
echo "📦 正在安装依赖项..."
npm install
# 复制环境文件
if [ ! -f .env ]; then
echo "📝 正在创建 .env 文件..."
cp .env.example .env
echo "⚠️ 请使用您的配置编辑 .env"
fi
# 运行数据库迁移
echo "🗄️ 正在运行数据库迁移..."
npm run migrate
# 验证设置
echo "🔍 正在验证设置..."
npm run test:setup
echo "✅ 设置完成!运行 'npm run dev' 以启动"
@brainstorming - 在设置前规划环境需求@systematic-debugging - 调试环境问题@doc-coauthoring - 创建设置文档@git-pushing - 设置 Git 配置专业提示: 创建一个 setup.sh 或 setup.ps1 脚本来自动化整个设置过程。在干净系统上测试以确保其有效!
每周安装次数
281
仓库
GitHub 星标数
27.1K
首次出现
2026 年 1 月 22 日
安全审计
安装于
opencode231
gemini-cli222
claude-code219
antigravity199
codex193
cursor188
Help developers set up complete development environments from scratch. This skill provides step-by-step guidance for installing tools, configuring dependencies, setting up environment variables, and verifying the setup works correctly.
I'll help you determine what needs to be installed:
Before installing anything, I'll help you check what's already installed:
# Check versions of installed tools
node --version
python --version
git --version
docker --version
I'll give platform-specific installation commands:
Help set up:
Provide verification steps to ensure everything works:
## Setting Up Node.js Development Environment
### Prerequisites
- macOS, Linux, or Windows
- Terminal/Command Prompt access
- Internet connection
### Step 1: Install Node.js
**macOS (using Homebrew):**
\`\`\`bash
# Install Homebrew if not installed
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Install Node.js
brew install node
\`\`\`
**Linux (Ubuntu/Debian):**
\`\`\`bash
# Update package list
sudo apt update
# Install Node.js and npm
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install -y nodejs
\`\`\`
**Windows (using Chocolatey):**
\`\`\`powershell
# Install Chocolatey if not installed
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
# Install Node.js
choco install nodejs
\`\`\`
### Step 2: Verify Installation
\`\`\`bash
node --version # Should show v20.x.x or higher
npm --version # Should show 10.x.x or higher
\`\`\`
### Step 3: Install Project Dependencies
\`\`\`bash
# Clone the repository
git clone https://github.com/your-repo/project.git
cd project
# Install dependencies
npm install
\`\`\`
### Step 4: Set Up Environment Variables
Create a \`.env\` file:
\`\`\`bash
# Copy example environment file
cp .env.example .env
# Edit with your values
nano .env
\`\`\`
Example \`.env\` content:
\`\`\`
NODE_ENV=development
PORT=3000
DATABASE_URL=postgresql://localhost:5432/mydb
API_KEY=your-api-key-here
\`\`\`
### Step 5: Run the Project
\`\`\`bash
# Start development server
npm run dev
# Should see: Server running on http://localhost:3000
\`\`\`
### Troubleshooting
**Problem:** "node: command not found"
**Solution:** Restart your terminal or run \`source ~/.bashrc\` (Linux) or \`source ~/.zshrc\` (macOS)
**Problem:** "Permission denied" errors
**Solution:** Don't use sudo with npm. Fix permissions:
\`\`\`bash
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
\`\`\`
## Setting Up Python Development Environment
### Step 1: Install Python
**macOS:**
\`\`\`bash
brew install python@3.11
\`\`\`
**Linux:**
\`\`\`bash
sudo apt update
sudo apt install python3.11 python3.11-venv python3-pip
\`\`\`
**Windows:**
\`\`\`powershell
choco install python --version=3.11
\`\`\`
### Step 2: Verify Installation
\`\`\`bash
python3 --version # Should show Python 3.11.x
pip3 --version # Should show pip 23.x.x
\`\`\`
### Step 3: Create Virtual Environment
\`\`\`bash
# Navigate to project directory
cd my-project
# Create virtual environment
python3 -m venv venv
# Activate virtual environment
# macOS/Linux:
source venv/bin/activate
# Windows:
venv\Scripts\activate
\`\`\`
### Step 4: Install Dependencies
\`\`\`bash
# Install from requirements.txt
pip install -r requirements.txt
# Or install packages individually
pip install flask sqlalchemy python-dotenv
\`\`\`
### Step 5: Set Up Environment Variables
Create \`.env\` file:
\`\`\`
FLASK_APP=app.py
FLASK_ENV=development
DATABASE_URL=sqlite:///app.db
SECRET_KEY=your-secret-key-here
\`\`\`
### Step 6: Run the Application
\`\`\`bash
# Run Flask app
flask run
# Should see: Running on http://127.0.0.1:5000
\`\`\`
## Setting Up Docker Development Environment
### Step 1: Install Docker
**macOS:**
\`\`\`bash
brew install --cask docker
# Or download Docker Desktop from docker.com
\`\`\`
**Linux:**
\`\`\`bash
# Install Docker
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
# Add user to docker group
sudo usermod -aG docker $USER
newgrp docker
\`\`\`
**Windows:**
Download Docker Desktop from docker.com
### Step 2: Verify Installation
\`\`\`bash
docker --version # Should show Docker version 24.x.x
docker-compose --version # Should show Docker Compose version 2.x.x
\`\`\`
### Step 3: Create docker-compose.yml
\`\`\`yaml
version: '3.8'
services:
app:
build: .
ports:
- "3000:3000"
environment:
- NODE_ENV=development
- DATABASE_URL=postgresql://postgres:password@db:5432/mydb
volumes:
- .:/app
- /app/node_modules
depends_on:
- db
db:
image: postgres:15
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=password
- POSTGRES_DB=mydb
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
volumes:
postgres_data:
\`\`\`
### Step 4: Start Services
\`\`\`bash
# Build and start containers
docker-compose up -d
# View logs
docker-compose logs -f
# Stop services
docker-compose down
\`\`\`
### Step 5: Verify Services
\`\`\`bash
# Check running containers
docker ps
# Test database connection
docker-compose exec db psql -U postgres -d mydb
\`\`\`
Symptoms: Installed tool but terminal doesn't recognize it Solution:
Restart terminal or source shell config
Check PATH environment variable
Verify installation location
echo $PATH
export PATH="/usr/local/bin:$PATH"
Symptoms: "EACCES" or "Permission denied" errors Solution:
Don't use sudo
Fix npm permissions or use nvm
Use virtual environments for Python
mkdir /.npm-global
npm config set prefix '/.npm-global'
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
Symptoms: "Port 3000 is already in use" Solution:
Find and kill process using the port
Use a different port
lsof -i :3000
kill -9 <PID>
PORT=3001 npm start
Symptoms: "Connection refused" or "Authentication failed" Solution:
Verify database is running
Check connection string
Verify credentials
sudo systemctl status postgresql
psql -h localhost -U postgres -d mydb
Create a setup.sh script to automate setup:
#!/bin/bash
echo "🚀 Setting up development environment..."
# Check prerequisites
command -v node >/dev/null 2>&1 || { echo "❌ Node.js not installed"; exit 1; }
command -v git >/dev/null 2>&1 || { echo "❌ Git not installed"; exit 1; }
echo "✅ Prerequisites check passed"
# Install dependencies
echo "📦 Installing dependencies..."
npm install
# Copy environment file
if [ ! -f .env ]; then
echo "📝 Creating .env file..."
cp .env.example .env
echo "⚠️ Please edit .env with your configuration"
fi
# Run database migrations
echo "🗄️ Running database migrations..."
npm run migrate
# Verify setup
echo "🔍 Verifying setup..."
npm run test:setup
echo "✅ Setup complete! Run 'npm run dev' to start"
@brainstorming - Plan environment requirements before setup@systematic-debugging - Debug environment issues@doc-coauthoring - Create setup documentation@git-pushing - Set up Git configurationPro Tip: Create a setup.sh or setup.ps1 script to automate the entire setup process. Test it on a clean system to ensure it works!
Weekly Installs
281
Repository
GitHub Stars
27.1K
First Seen
Jan 22, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
opencode231
gemini-cli222
claude-code219
antigravity199
codex193
cursor188
agent-browser 浏览器自动化工具 - Vercel Labs 命令行网页操作与测试
140,500 周安装