Merge pull request #1970 from ssplatt/del-if-exists
Check if directory exists before deleting
This commit is contained in:
1 file changed
+19
-15
@@ -1,4 +1,5 @@
|
|||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
const fs = require("fs");
|
||||||
const process = require("process");
|
const process = require("process");
|
||||||
const { exec } = require("child_process");
|
const { exec } = require("child_process");
|
||||||
const systemCheck = require('./Launch-Scripts/system-check')
|
const systemCheck = require('./Launch-Scripts/system-check')
|
||||||
@@ -76,21 +77,24 @@ for (let dir of nodeModulesDirs) {
|
|||||||
removeCommand = "echo Removing old Node_Modules at "+ dir + " & rm -rf node_modules/";
|
removeCommand = "echo Removing old Node_Modules at "+ dir + " & rm -rf node_modules/";
|
||||||
}
|
}
|
||||||
|
|
||||||
exec( removeCommand,
|
let node_dir = path.join(dir, "node_modules")
|
||||||
{
|
if (fs.existsSync(node_dir)) {
|
||||||
cwd: dir
|
exec( removeCommand,
|
||||||
},
|
{
|
||||||
function ( error, stdout ){
|
cwd: dir
|
||||||
if (error) {
|
},
|
||||||
|
function ( error, stdout ){
|
||||||
|
if (error) {
|
||||||
|
console.log('');
|
||||||
|
console.log("There was an error installing some dependencies error: ");
|
||||||
|
console.log('');
|
||||||
|
console.log( error );
|
||||||
|
return;
|
||||||
|
}
|
||||||
console.log('');
|
console.log('');
|
||||||
console.log("There was an error installing some dependencies error: ");
|
console.log( stdout );
|
||||||
console.log('');
|
});
|
||||||
console.log( error );
|
}
|
||||||
return;
|
|
||||||
}
|
|
||||||
console.log('');
|
|
||||||
console.log( stdout );
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Install Node_Modules to Main Superalgos Directory
|
// Install Node_Modules to Main Superalgos Directory
|
||||||
@@ -132,4 +136,4 @@ function tfjsWinInstall() {
|
|||||||
console.log("\n1.) Reinstall node.js from https://nodejs.org/en/download/ @Version 14.17.5 or higher.\nDuring installation, when you arrive at the 'Tools for Native Modules' screen you need to select the box to:\n\t'Automatically install the necessary tools...Chocolatey...'");
|
console.log("\n1.) Reinstall node.js from https://nodejs.org/en/download/ @Version 14.17.5 or higher.\nDuring installation, when you arrive at the 'Tools for Native Modules' screen you need to select the box to:\n\t'Automatically install the necessary tools...Chocolatey...'");
|
||||||
console.log("Doing this will cause a pop-up script in a new window which will install many npm/node tools and dependencies for use within the WinOS ecosystem.");
|
console.log("Doing this will cause a pop-up script in a new window which will install many npm/node tools and dependencies for use within the WinOS ecosystem.");
|
||||||
console.log("2.) When the installations finally complete you need to navigate back to your Superalgos directory and run `node setup` again.\n");
|
console.log("2.) When the installations finally complete you need to navigate back to your Superalgos directory and run `node setup` again.\n");
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user