ENOENT, no such file or directory

in product.js:

After new Date().toISOString() add replace() to change ":" to an accepted character.

Windows OS doesn't accept files with a ":"

The person on Youtube is using MAC OS

E.g

new Date().toISOString().replace(/:/g, '-')


Try the following:

  1. Require this as a constant (const path = require('path');)
  2. Change this line

    cb(null, './uploads/');

With this:

cb(null, path.join(__dirname, '/uploads/'));

As I can see, you are trying to get a path that is not on served on the server, but rather a path that is on the server machine.

UPDATE

Try also changing this

app.use('/uploads', express.static('uploads'));

To this:

app.use(express.static(__dirname));

In order to expose the __dirname for static files.