rm -rf node_modules
npm install
git commit package-lock.json
git push
fs.mkdirSync(targetDir, { recursive: true });
// or
fs.promises.mkdir(targetDir, { recursive: true });
Have you created a package.json file? Maybe run this command first again.
C:UsersNuwanstDocumentsNodeJS3.chat>npm init
It creates a package.json file in your folder.
Then run,
C:UsersNuwanstDocumentsNodeJS3.chat>npm install socket.io --save
The --save ensures your module is saved as a dependency in your package.json file.
cloudinary.config({
cloud_name: process.env.CLOUDINARY_NAME,
api_key: process.env.CLOUDINARY_API_KEY,
api_secret: process.env.CLOUDINARY_API_SECRET,
shorten: true,
secure: true,
ssl_detected: true
})
const response = await cloudinary.uploader.upload(req.file.path)
console.log(response)