尧图建网站 尧图建网站 YAOTU WEB BUILD 免费咨询
ARTICLE DETAIL

资讯详情

深耕网站建设与建站编程的一线实战洞察。

OpenAI Codex Agent安装部署

OpenAI Codex Agent安装部署 官方教程https://developers.openai.com/codex/cli?utm_sourcechatgpt.com1、安装npmsudo apt update #更新 sudo apt --fix-broken install #修复 sudo apt upgrade -y #详细更新 sudo apt install -y nodejs npm #装npm总共需要10分钟左右 node -v npm -v #确认否安装成功2、检查版本匹配npm install -g openai/codex这里可能会提示你需要node16版本以上还有npm的权限问题(base) useruser:~/software$ node -v npm -v v12.22.9 8.5.1 (base) useruser:~/software$ npm install -g openai/codex npm WARN EBADENGINE Unsupported engine { npm WARN EBADENGINE package: openai/codex0.115.0, npm WARN EBADENGINE required: { node: 16 }, npm WARN EBADENGINE current: { node: v12.22.9, npm: 8.5.1 } npm WARN EBADENGINE } npm ERR! code EACCES npm ERR! syscall mkdir npm ERR! path /usr/local/lib/node_modules npm ERR! errno -13 npm ERR! Error: EACCES: permission denied, mkdir /usr/local/lib/node_modules npm ERR! [Error: EACCES: permission denied, mkdir /usr/local/lib/node_modules] { npm ERR! errno: -13, npm ERR! code: EACCES, npm ERR! syscall: mkdir, npm ERR! path: /usr/local/lib/node_modules npm ERR! } npm ERR! npm ERR! The operation was rejected by your operating system. npm ERR! It is likely you do not have the permissions to access this file as the current user npm ERR! npm ERR! If you believe this might be a permissions issue, please double-check the npm ERR! permissions of the file and its containing directories, or try running npm ERR! the command again as root/Administrator. npm ERR! A complete log of this run can be found in: npm ERR! /home/user/.npm/_logs/2026-03-18T02_29_54_889Z-debug-0.log再次手动安装nvmNode版本管理器1创建目录并下载 nvm 脚本export NVM_DIR$HOME/.nvm mkdir -p $NVM_DIR curl -L https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.4/nvm.sh -o $NVM_DIR/nvm.sh curl -L https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.4/bash_completion -o $NVM_DIR/bash_completion chmod x $NVM_DIR/nvm.sh2写入~/.bashrccat ~/.bashrc EOF export NVM_DIR$HOME/.nvm [ -s $NVM_DIR/nvm.sh ] \. $NVM_DIR/nvm.sh [ -s $NVM_DIR/bash_completion ] \. $NVM_DIR/bash_completion EOFsource ~/.bashrc nvm -v3装新nodenvm install 20 nvm use 20 nvm alias default 20node -v npm -v which node which npm这里的which node和which npm最好都指向你家目录下的~/.nvm/...而不是/usr/bin/node。这是为了避免继续用到系统自带的老版本。这个行为符合 nvm 的按用户、按 shell 管理版本的设计3、安装codexnpm install -g openai/codex npm i -g openai/codexlatest然后enter登录GPT账号无痕模式、换节点、更新这些方式都试试解决因为接入地区无法登入的问题ps没有sudo权限时候可以如下安装部署# 1. 安装 nvm用户目录不需要 sudo curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.6/install.sh | bash # 2. 重新加载 shell source ~/.bashrc # 如果你用的是 zsh则 # source ~/.zshrc # 3. 安装 Node.js LTS nvm install --lts # 4. 检查 Node/npm node -v npm -v # 5. 安装 Codex CLI npm install -g openai/codex # 6. 检查 Codex codex --version
返回列表