From 74916670eb6eaea6881a1c767b1507f38a357f3b Mon Sep 17 00:00:00 2001 From: whyour Date: Tue, 13 Feb 2024 15:19:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=AE=BE=E7=BD=AE=20nodejs?= =?UTF-8?q?=20=E9=95=9C=E5=83=8F=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/services/system.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/back/services/system.ts b/back/services/system.ts index 26d4be54..379cfb14 100644 --- a/back/services/system.ts +++ b/back/services/system.ts @@ -29,6 +29,7 @@ import tar from 'tar'; import path from 'path'; import fs from 'fs'; import sum from 'lodash/sum'; +import { DependenceModel, DependenceStatus, DependenceTypes } from '../data/dependence'; @Service() export default class SystemService { @@ -136,7 +137,13 @@ export default class SystemService { if (info.nodeMirror) { cmd = `pnpm config set registry ${info.nodeMirror}`; } - const command = `cd && ${cmd} && pnpm i -g`; + let command = `cd && ${cmd}`; + const docs = await DependenceModel.findAll({ + where: { type: DependenceTypes.nodejs, status: DependenceStatus.installed }, + }); + if (docs.length > 0) { + command += ` && pnpm i -g`; + } this.scheduleService.runTask( command, {