S
SolidJS6mo ago
Sem

ReferenceError: __filename is not defined in ES module scope

I've created an app using solid-start and sucessfuly hosting it on my windows PC with no issue. But then I decided to change host to my Rasberry Pi 4 running ubuntu server. Everything went fine and I've managed to build my app again just like on Windows machine (environment is the same on both machine - node.js 20.8.10, npm 10.1) Build messages are the same, everything goes fine. I'm even able to run dev server on my Pi and connect to it. But when I run solid-start build and then solid-start start I'm getting this message:
file:///home/admin/repos/app/dist/server.js:72828
return !fileExists(swapCase(__filename));
^

ReferenceError: __filename is not defined in ES module scope
This file is being treated as an ES module because it has a '.js' file extension and '/home/admin/repos/app/package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.
at isFileSystemCaseSensitive (file:///home/admin/repos/app/dist/server.js:72828:47)
at getNodeSystem (file:///home/admin/repos/app/dist/server.js:72593:47)
at file:///home/admin/repos/app/dist/server.js:73062:21
at file:///home/admin/repos/app/dist/server.js:73069:9
at file:///home/admin/repos/app/dist/server.js:73084:5
at requireTypescript (file:///home/admin/repos/app/dist/server.js:239773:4)
at file:///home/admin/repos/app/dist/server.js:239777:25
at ModuleJob.run (node:internal/modules/esm/module_job:194:25)
file:///home/admin/repos/app/dist/server.js:72828
return !fileExists(swapCase(__filename));
^

ReferenceError: __filename is not defined in ES module scope
This file is being treated as an ES module because it has a '.js' file extension and '/home/admin/repos/app/package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.
at isFileSystemCaseSensitive (file:///home/admin/repos/app/dist/server.js:72828:47)
at getNodeSystem (file:///home/admin/repos/app/dist/server.js:72593:47)
at file:///home/admin/repos/app/dist/server.js:73062:21
at file:///home/admin/repos/app/dist/server.js:73069:9
at file:///home/admin/repos/app/dist/server.js:73084:5
at requireTypescript (file:///home/admin/repos/app/dist/server.js:239773:4)
at file:///home/admin/repos/app/dist/server.js:239777:25
at ModuleJob.run (node:internal/modules/esm/module_job:194:25)
0 Replies
No replies yetBe the first to reply to this messageJoin