humanus.cpp/.devops/scripts/setup-npm.sh

35 lines
849 B
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#!/bin/bash
# 该脚本在容器内运行用于设置Node.js和npm
echo "=== 安装Node.js和npm ==="
# 首先安装curl如果没有
if ! command -v curl &> /dev/null; then
apt-get update
apt-get install -y curl
fi
# 安装Node.js
echo "正在安装Node.js..."
curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
apt-get install -y nodejs
# 验证安装
echo "Node.js版本:"
node --version
echo "npm版本:"
npm --version
# 设置npm淘宝镜像
echo "配置npm使用淘宝镜像..."
npm config set registry https://registry.npmmirror.com
# 安装项目所需的npm包
echo "安装项目所需的npm包..."
npm install -g @modelcontextprotocol/server-puppeteer \
@modelcontextprotocol/server-filesystem \
@kevinwatt/shell-mcp \
@modelcontextprotocol/server-everything
echo "Node.js和npm设置完成。"