安装说明
本文档详细介绍 TeleScopeX 的各种安装方式。
方式一:全局安装(推荐)
这是最常用的安装方式,可以在系统任何位置使用 TeleScopeX。
使用 npm
bash
npm install -g telescopex使用 yarn
bash
yarn global add telescopex使用 pnpm
bash
pnpm add -g telescopex验证安装
bash
telescopex --version
# 或
tsx --version方式二:本地开发安装
如果您想参与 TeleScopeX 的开发或自定义功能:
1. 克隆仓库
bash
git clone https://github.com/telefe/telescopex.git
cd telescopex2. 安装依赖
bash
npm install3. 运行
bash
node index.js4. 创建全局链接(可选)
bash
npm link现在您可以在任何位置使用 telescopex 命令,它会指向您本地的开发版本。
方式三:团队共享安装
如果您的团队使用统一的项目配置:
1. 作为项目依赖安装
bash
cd your-project
npm install --save-dev telescopex2. 在 package.json 中添加脚本
json
{
"scripts": {
"auth": "telescopex"
}
}3. 运行
bash
npm run auth系统要求
必需
- Node.js >= 14.0.0
- npm >= 6.0.0(或 yarn、pnpm)
- Chrome 浏览器
推荐
- Node.js >= 16.0.0(获得更好的性能)
- 最新版本的 Chrome(确保兼容性)
依赖说明
TeleScopeX 依赖以下 npm 包:
| 包名 | 版本 | 用途 |
|---|---|---|
chalk | ^4.1.2 | 终端颜色输出 |
figlet | ^1.9.4 | ASCII 艺术字 |
gradient-string | ^3.0.0 | 渐变色文本 |
inquirer | ^8.2.7 | 交互式命令行 |
ora | ^5.4.1 | 加载动画 |
playwright | ^1.57.0 | 浏览器自动化 |
所有依赖会在安装时自动安装。
更新
检查更新
bash
npm outdated -g telescopex更新到最新版本
bash
npm update -g telescopex更新到特定版本
bash
npm install -g telescopex@1.2.0卸载
全局卸载
bash
npm uninstall -g telescopex项目依赖卸载
bash
npm uninstall telescopex清理缓存(可选)
bash
npm cache clean --force离线安装
如果您在无网络环境中工作:
1. 在有网络的机器上打包
bash
npm pack telescopex这会生成 telescopex-1.0.0.tgz 文件。
2. 复制到目标机器并安装
bash
npm install -g telescopex-1.0.0.tgz代理配置
如果您的网络环境需要代理:
设置 npm 代理
bash
npm config set proxy http://proxy.company.com:8080
npm config set https-proxy http://proxy.company.com:8080然后安装
bash
npm install -g telescopex权限问题
macOS/Linux
如果遇到权限错误,可以:
方案 1:使用 sudo(不推荐)
bash
sudo npm install -g telescopex方案 2:更改 npm 默认目录(推荐)
bash
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.zshrc
source ~/.zshrc
npm install -g telescopexWindows
以管理员身份运行命令提示符或 PowerShell,然后执行安装命令。
验证安装
安装完成后,运行以下命令验证:
bash
# 检查版本
telescopex --version
# 查看帮助
telescopex --help
# 测试运行
cd your-project
telescopex故障排除
命令未找到
确保 npm 全局 bin 目录在您的 PATH 中:
bash
# 查看 npm bin 目录
npm bin -g
# 查看 PATH
echo $PATH安装速度慢
使用淘宝镜像:
bash
npm install -g telescopex --registry=https://registry.npmmirror.com或永久配置:
bash
npm config set registry https://registry.npmmirror.com依赖安装失败
清理缓存后重试:
bash
npm cache clean --force
npm install -g telescopex