I want to make with node.js a mini script which creates for me a standard Folder named "Projekt" and in the next steps make a Folder with the three Files index.html, app-js, and styles.css.
const mkdir = require('mkdir');
//const folderName = process.argv[2] || 'Project'
mkdir('Project', { recursive: true }, (err) => {
console.log(err);
if (err) throw err;
});
console.log("After MKDIR Statement");
/*try {
mkdir.mkdirSync(folderName);
mkdir.writeFileSync(`${folderName}/index.html`);
mkdir.writeFileSync(`${folderName}/app.js`);
mkdir.writeFileSync(`${folderName}/styles.css`);
} catch (e) {
console.log("SOMETHING WENT WRONG!!!");
console.log(e);
}*/
I get following response by the terminal in VS-CODE
:\\Users\\George\\Desktop\\NPM - Tutorial\> node bolerplate.js
node:internal/modules/cjs/loader:1080
throw err;
^
**Error: Cannot find module 'mkdir'**
- A Folder with the name 'Project'
- Make a Folder by a default name with three files index.html, app.js, styles.css
I think you're importing it wrong.
Try to import it like this code:
i get it from the official docs