一.npm常用命令
- npm --version 查看版本
- npm root -g 查看安装目录
3.远程拉取playwright-mcp-server到本地缓存目录 npx -y --registry=registry.npmmirror.com@executeautomation/playwright-…
4.npm config get cache 查看缓存目录
5.where node 查看node安装目录
- node -v 查看node版本
-
npm install -g @executeautomation/playwright-mcp-server 全局安装@executeautomation插件
-
npm list -g 查看@executeautomation插件的位置
注意:npm 全局安装的包默认不会放在 Node.js 的安装目录(D:\Program Files\SoftInstall\Nodejs\node_modules\npm\node_modules)下,这是 npm 的默认设计行为。
- npx playwright install chromium 安装 chromium浏览器
- npx playwright uninstall 可以移除所有已安装的浏览器
二. 设置国内镜像
要将 npm install -g @executeautomation/playwright-mcp-server改为使用国内镜像下载,主要有以下几种方法:
方法一:使用 cnpm(淘宝镜像的客户端)
这是最直接的方式,cnpm会自动使用淘宝的镜像源。
-
安装 cnpm(如果尚未安装):
npm install -g cnpm --registry=https://registry.npmmirror.com -
使用 cnpm 安装:
cnpm install -g @executeautomation/playwright-mcp-server
方法二:临时使用镜像源(单次命令)
在 npm install命令后添加 --registry参数,指定镜像地址。
npm install -g @executeautomation/playwright-mcp-server --registry=https://registry.npmmirror.com
方法三:永久切换 npm 的镜像源(推荐)
直接修改 npm 的默认 registry 配置,这样以后所有 npm install命令都会使用国内镜像。
-
设置淘宝镜像:
npm config set registry https://registry.npmmirror.com -
验证是否设置成功:
npm config get registry如果返回
https://registry.npmmirror.com就表示设置成功了。 -
之后正常安装即可:
npm install -g @executeautomation/playwright-mcp-server
常用国内镜像地址
- 淘宝镜像:
https://registry.npmmirror.com - 腾讯云镜像:
https://mirrors.cloud.tencent.com/npm/ - 华为云镜像:
https://repo.huaweicloud.com/repository/npm/