From 9a86b3495698597340e6a0d726b669ccc06dd8cf Mon Sep 17 00:00:00 2001 From: Renaud Heluin Date: Tue, 15 Oct 2024 22:47:53 +0200 Subject: [PATCH] fix: try fixing on Windows --- src/main/handlers/initHandlers/plugin_canInstall.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/handlers/initHandlers/plugin_canInstall.ts b/src/main/handlers/initHandlers/plugin_canInstall.ts index 84eb899..fb7da5b 100644 --- a/src/main/handlers/initHandlers/plugin_canInstall.ts +++ b/src/main/handlers/initHandlers/plugin_canInstall.ts @@ -77,10 +77,11 @@ export const initSudoFixNpmDirRights = ( const toReturned = new ConfigData('fix_npm_user_rights') return new Promise((resolve) => { const libPath = path.join(`lib`, `node_modules`) + const npmDir = (store.get(`npmDir`, null) || getNpmDir()) as string let cmd = `` if (os.platform() === 'win32') { // cmd = `mkdir $(npm config get prefix)\\${libPath} & TAKEOWN /F $(npm config get prefix)\\${libPath} /R & TAKEOWN /F $(npm config get prefix)\\bin /R & TAKEOWN /F $(npm config get prefix)\\share /R & echo "Done"` - cmd = `mkdir $(npm config get prefix)\\node_modules & icacls $(npm config get prefix)\\node_modules /reset /t /c /l /q & echo "Done"` + cmd = `icacls $(npm config get prefix) /reset /t /c /l /q; mkdir ${npmDir}; echo "Done"` } else { cmd = `mkdir -p $(npm config get prefix)/${libPath} && chown -R $USER $(npm config get prefix)/{${libPath},bin,share} && echo "Done"` }