Relative path return 404 on ubuntu

I developed a small nodejs application and I’m facing a weird issue. Essentially, I’m using ExpressJS and I configured the static files, such as (js, css, etc…) to that path:

app.use(express.static(path.join(__dirname, "../public"))); 

when I run the application on windows I have no problem, all the css and js file are loaded correctly, eg:

<!-- STYLE CSS --> <link rel="stylesheet" href="/css/bootstrap.min.css"> <link rel="stylesheet" href="/css/style.css"> <link rel="stylesheet" href="/css/custom-style.css"> 

but when I run the app on ubuntu I get the 404 error.

I suspect there is something that doesn’t works on the double dots ../, infact I had the following loader first:

require('dotenv').config({     path: `./env-files/$  {process.env.NODE_ENV || 'development'}.env` }); 

and I changed it to get it working.

require('dotenv').config({     path: __dirname + '/env-files/' + `$  {process.env.NODE_ENV || 'development'}.env` }); 

Perhaps ubuntu doesn’t support the above syntax?

The structure of the app is:

app.js      config           environment.js      public            css           js 

the file environment.js load the folder public