Skip to content

安装说明

本文档详细介绍 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 telescopex

2. 安装依赖

bash
npm install

3. 运行

bash
node index.js

4. 创建全局链接(可选)

bash
npm link

现在您可以在任何位置使用 telescopex 命令,它会指向您本地的开发版本。

方式三:团队共享安装

如果您的团队使用统一的项目配置:

1. 作为项目依赖安装

bash
cd your-project
npm install --save-dev telescopex

2. 在 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.4ASCII 艺术字
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 telescopex

Windows

以管理员身份运行命令提示符或 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

下一步

Released under the MIT License.