Skip to content

Commit

Permalink
fix: try fixing on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
hrenaud committed Oct 15, 2024
1 parent 3650784 commit 9a86b34
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/handlers/initHandlers/plugin_canInstall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,11 @@ export const initSudoFixNpmDirRights = (
const toReturned = new ConfigData('fix_npm_user_rights')
return new Promise<ConfigData>((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"`
}
Expand Down

0 comments on commit 9a86b34

Please sign in to comment.