1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Ensure external modules are installed synchronously

Fixes #4168
This commit is contained in:
Nick O'Leary 2023-05-22 14:24:11 +01:00
parent c2387777c9
commit 18610bb540
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -242,7 +242,9 @@ async function ensureModuleDir() {
} }
} }
let installLock = Promise.resolve()
async function installModule(moduleDetails) { async function installModule(moduleDetails) {
const result = installLock.then(async () => {
let installSpec = moduleDetails.module; let installSpec = moduleDetails.module;
if (!registryUtil.checkModuleAllowed( moduleDetails.module, moduleDetails.version,installAllowList,installDenyList)) { if (!registryUtil.checkModuleAllowed( moduleDetails.module, moduleDetails.version,installAllowList,installDenyList)) {
const e = new Error("Install not allowed"); const e = new Error("Install not allowed");
@ -299,6 +301,9 @@ async function installModule(moduleDetails) {
throw e; throw e;
} }
}) })
})
installLock = result.catch(() => {})
return result
} }
module.exports = { module.exports = {