跳到主要内容

安装

要求​

  • Node.js 18.0 或更高版本
  • npm 8.0 或更高版本(随 Node.js 一起提供)
  • Git(用于版本控制功能)

通过 npm 安装​

npm install -g archicore

验证安装​

archicore --version
# ArchiCore v0.1.0

认证​

使用 ArchiCore 之前,您需要进行认证:

archicore login

这将:

  1. 打开浏览器到 ArchiCore 登录页面
  2. 登录后自动配置 CLI
  3. 安全存储凭据

设备码流程(无界面)​

对于没有浏览器的服务器:

archicore login --device-code

这会显示一个代码,需要在 ArchiCore Device Auth 输入。

初始化项目​

导航到您的项目目录并运行:

cd /您的/项目/路径
archicore init

这会创建一个带有默认配置的 .archicore/ 目录。

更新​

npm update -g archicore

卸载​

npm uninstall -g archicore

同时删除配置:

rm -rf ~/.archicore

特定平台说明​

Windows​

使用 PowerShell 或 Git Bash。命令提示符可以工作但功能有限。

# PowerShell
npm install -g archicore

Linux​

全局安装可能需要 sudo:

sudo npm install -g archicore

或配置 npm 使用本地目录:

mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
npm install -g archicore

macOS​

npm install -g archicore

如果遇到权限错误:

sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}
npm install -g archicore

故障排除​

"EACCES: 权限被拒绝"​

不要使用 sudo npm install。而是修复 npm 权限:

mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
export PATH=~/.npm-global/bin:$PATH

"archicore: 命令未找到"​

确保 npm 全局 bin 在 PATH 中:

export PATH="$(npm bin -g):$PATH"

添加到 ~/.bashrc 或 ~/.zshrc 以使其永久生效。

代理后​

npm config set proxy http://proxy.company.com:8080
npm config set https-proxy http://proxy.company.com:8080
npm install -g archicore