2026/5/21 13:32:36
网站建设
项目流程
江都网站建设,企业网站虚假宣称iso9001的处罚案例,网页设计达人及作品推荐,网站建设与 维护实训报告范文ClaudeCode安装记录ClaudeCode目前目前支持配置AutoGLM和Kimi#xff1b;Mac版本会相对简单一点#xff0c;AutoGLM配了自动化的部署脚本#xff0c;Windows会稍微复杂一点#xff0c;需要自己配置环境变量1-参考网址
尚硅谷ClaudeCode使用教程#xff1a;https://www.bil…ClaudeCode安装记录ClaudeCode目前目前支持配置AutoGLM和KimiMac版本会相对简单一点AutoGLM配了自动化的部署脚本Windows会稍微复杂一点需要自己配置环境变量1-参考网址尚硅谷ClaudeCode使用教程https://www.bilibili.com/video/BV1vG8QzcE5XMAC设置本地代理参考https://zhuanlan.zhihu.com/p/1891348757653717263解决国家不能访问https://blog.csdn.net/qq_35376047/article/details/150064785AutoGLM直接修改-支持访问(Windows直接参考这个)https://docs.bigmodel.cn/cn/guide/develop/claudeClaude的命令行使用参考https://cloud.tencent.com/developer/article/2547347KIMI申请API_KEY:https://platform.moonshot.cn/console/api-keys2-Windows安装配置环境变量CLAUDE_CODE_GIT_BASH_PATHgit的路径D:\TT_INSTALL\GIT\bin\bash.exe ANTHROPIC_API_KEY:XXXXXXXXXXXXXXXXXXXXXXX ANTHROPIC_BASE_URL:https://api.moonshot.cn/anthropic安装claude-codenpm install -g anthropic-ai/claude-code编辑C:\Users\popyu.claude.json当前在代码中添加hasCompletedOnboardingtrue之后就可以进行使用了参考网址:https://blog.csdn.net/qq_35376047/article/details/150064785{installMethod:npm-global,cachedStatsigGates:{tengu_disable_bypass_permissions_mode:false,tengu_thinkback:false,tengu_sumi:false,tengu_prompt_suggestion:false},mcpServers:{},firstStartTime:2025-12-18T11:31:06.602Z,sonnet45MigrationComplete:true,opus45MigrationComplete:true,thinkingMigrationComplete:true,hasCompletedOnboarding:true}3-Mac安装使用AutoGLM的脚本直接就安装了https://docs.bigmodel.cn/cn/guide/develop/claude#!/bin/bashset-euo pipefail# # 常量定义# SCRIPT_NAME$(basename$0)NODE_MIN_VERSION18NODE_INSTALL_VERSION22NVM_VERSIONv0.40.3CLAUDE_PACKAGEanthropic-ai/claude-codeCONFIG_DIR$HOME/.claudeCONFIG_FILE$CONFIG_DIR/settings.jsonAPI_BASE_URLhttps://open.bigmodel.cn/api/anthropicAPI_KEYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXAPI_TIMEOUT_MS3000000# # 工具函数# log_info(){echo$*}log_success(){echo✅$*}log_error(){echo❌$*2}ensure_dir_exists(){localdir$1if[!-d$dir];thenmkdir-p$dir||{log_errorFailed to create directory:$direxit1}fi}# # Node.js 安装函数# install_nodejs(){localplatform$(uname-s)case$platforminLinux|Darwin)log_infoInstalling Node.js on$platform...# 安装 nvmlog_infoInstalling nvm ($NVM_VERSION)...curl-s https://raw.githubusercontent.com/nvm-sh/nvm/$NVM_VERSION/install.sh|bash# 加载 nvmlog_infoLoading nvm environment...\.$HOME/.nvm/nvm.sh# 安装 Node.jslog_infoInstalling Node.js$NODE_INSTALL_VERSION...nvminstall$NODE_INSTALL_VERSION# 验证安装node -v/dev/null||{log_errorNode.js installation failedexit1}log_successNode.js installed:$(node -v)log_successnpm version:$(npm-v);;*)log_errorUnsupported platform:$platformexit1;;esac}# # Node.js 检查函数# check_nodejs(){ifcommand-v node/dev/null;thencurrent_version$(node -v|seds/v//)major_version$(echo$current_version|cut-d. -f1)if[$major_version-ge$NODE_MIN_VERSION];thenlog_successNode.js is already installed: v$current_versionreturn0elselog_infoNode.js v$current_versionis installed but version $NODE_MIN_VERSION. Upgrading...install_nodejsfielselog_infoNode.js not found. Installing...install_nodejsfi}# # Claude Code 安装# install_claude_code(){ifcommand-v claude/dev/null;thenlog_successClaude Code is already installed:$(claude --version)elselog_infoInstalling Claude Code...npminstall-g$CLAUDE_PACKAGE||{log_errorFailed to install claude-codeexit1}log_successClaude Code installed successfullyfi}configure_claude_json(){node --eval const os require(os); const fs require(fs); const path require(path); const homeDir os.homedir(); const filePath path.join(homeDir, .claude.json); if (fs.existsSync(filePath)) { const content JSON.parse(fs.readFileSync(filePath, utf-8)); fs.writeFileSync(filePath, JSON.stringify({ ...content, hasCompletedOnboarding: true }, null, 2), utf-8); } else { fs.writeFileSync(filePath, JSON.stringify({ hasCompletedOnboarding: true }, null, 2), utf-8); }}# # API Key 配置# configure_claude(){log_infoConfiguring Claude Code...ensure_dir_exists$CONFIG_DIR# 写入配置文件node --eval const os require(os); const fs require(fs); const path require(path); const homeDir os.homedir(); const filePath path.join(homeDir, .claude, settings.json); const apiKey $API_KEY;const contentfs.existsSync(filePath)? JSON.parse(fs.readFileSync(filePath,utf-8)):{};fs.writeFileSync(filePath, JSON.stringify({...content, env:{ANTHROPIC_AUTH_TOKEN: apiKey, ANTHROPIC_BASE_URL:$API_BASE_URL, API_TIMEOUT_MS:$API_TIMEOUT_MS, CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC:1}}, null,2),utf-8);||{log_errorFailed to write settings.jsonexit1}log_successClaude Code configured successfully}# # 主流程# main(){echo Starting$SCRIPT_NAMEcheck_nodejs install_claude_code configure_claude_json configure_claudeecholog_success Installation completed successfully!echoecho You can now start using Claude Code with:echo claude}main$配置环境配置环境变量如果使用脚本可以跳过该步骤echo export ANTHROPIC_API_KEYXXXXXXXXXXXXX ~/.zshrc echo export https_proxyhttps://api.moonshot.cn/anthropic ~/.zshrc source ~/.zshrc echo export ANTHROPIC_API_KEYXXXXXXXXXXXXX ~/.bash_profile echo export https_proxyhttps://api.moonshot.cn/anthropic ~/.bash_profile source ~/.bash_profile4-网络代理设置echo export http_proxyhttp://127.0.0.1:7890 ~/.zshrc echo export https_proxyhttp://127.0.0.1:7890 ~/.zshrc source ~/.zshrc echo export http_proxyhttp://127.0.0.1:7890 ~/.bash_profile echo export https_proxyhttp://127.0.0.1:7890 ~/.bash_profile source ~/.bash_profile5-原版备份cat ~/.claude/settings.json 在env中添加ANTHROPIC_API_KEY和ANTHROPIC_BASE_URL配置{ $schema: https://json.schemastore.org/claude-code-settings.json, env: { DISABLE_TELEMETRY: 1, DISABLE_ERROR_REPORTING: 1, CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC: 1, MCP_TIMEOUT: 60000 }, includeCoAuthoredBy: false, permissions: { allow: [ Bash, BashOutput, Edit, Glob, Grep, KillShell, NotebookEdit, Read, SlashCommand, Task, TodoWrite, WebFetch, WebSearch, Write, mcp__ide, mcp__exa, mcp__context7, mcp__mcp-deepwiki, mcp__Playwright, mcp__spec-workflow, mcp__open-websearch, mcp__serena ], deny: [] }, hooks: {}, outputStyle: engineer-professional }6-配置中文展示工作目录创建.claude 文件夹内部创建一个setting.json文件核心是language_preferences配置vim ./.claude/settings.json{ model: claude-3-5-sonnet-20241022, max_tokens: 4000, temperature: 0.7, auto_approve: false, git_integration: true, excluded_files: [ node_modules/**, .git/**, *.log, dist/** ], language_preferences: { documentation: zh-CN, code_comments: zh-CN } }