diff --git a/scripts/post-install.js b/scripts/post-install.js index 34b631af..1c953a81 100644 --- a/scripts/post-install.js +++ b/scripts/post-install.js @@ -47,9 +47,16 @@ async function linkSharedResources(pkgJSON, packagePath) { fs.mkdirSync(path.resolve(finalLinkPath, ".."), { recursive: true }) } - fs.symlinkSync(originClassPath, finalLinkPath, "dir") - - console.log(`🔗 Linked resouce [${resource}] to [${finalLinkPath}]`) + try { + fs.symlinkSync(originClassPath, finalLinkPath, "dir") + console.log(`🔗 Linked resouce [${resource}] to [${finalLinkPath}]`) + } catch (error) { + if (error.code && error.code == 'EEXIST') { + fs.unlinkSync(finalLinkPath) + fs.symlinkSync(originClassPath, finalLinkPath, "dir") + console.log(`🔗 Linked resouce [${resource}] to [${finalLinkPath}]`) + } + } continue } @@ -138,4 +145,4 @@ async function main() { console.timeEnd("✅ post-install tooks:") } -main().catch(console.error) \ No newline at end of file +main().catch(console.error)