🐛 修复插件安装镜像地址问题:https://zhuanlan.zhihu.com/p/432578145

This commit is contained in:
muwoo
2023-08-18 14:42:55 +08:00
parent 637c1238ae
commit 62bcc345da
3 changed files with 7 additions and 7 deletions

View File

@@ -52,7 +52,7 @@ class AdapterHandler {
} catch (e) {
// ignore
}
this.registry = register || 'https://registry.npm.taobao.org';
this.registry = register || 'https://registry.npmmirror.com/';
}
async upgrade(name: string): Promise<void> {
@@ -157,14 +157,14 @@ class AdapterHandler {
*/
private async execCommand(cmd: string, modules: string[]): Promise<string> {
return new Promise((resolve: any, reject: any) => {
let args: string[] = [cmd]
const args: string[] = [cmd]
.concat(
cmd !== 'uninstall' ? modules.map((m) => `${m}@latest`) : modules
)
.concat('--color=always')
.concat('--save');
if (cmd !== 'uninstall')
args = args.concat(`--registry=${this.registry}`);
.concat('--save')
.concat(`--registry=${this.registry}`);
const npm = spawn('npm', args, {
cwd: this.baseDir,
});