S
SolidJS16mo ago
Arctic

solid-start dev works, solid-start start does not

My program uses tesseract.js, and it works fine in dev mode as the title states. However, when I try to run it with start, I get the following error:
file:///home/user/code/fr33split/dist/server.js:17744
workerPath: path.join(__dirname, '..', '..', 'worker-script', 'node', 'index.js'),
^

ReferenceError: __dirname 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/user/code/fr33split/package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.
at requireDefaultOptions (file:///home/user/code/fr33split/dist/server.js:17744:26)
at requireNode (file:///home/user/code/fr33split/dist/server.js:99541:25)
at requireCreateWorker (file:///home/user/code/fr33split/dist/server.js:99578:6)
at requireSrc (file:///home/user/code/fr33split/dist/server.js:100097:23)
at file:///home/user/code/fr33split/dist/server.js:100116:18
at ModuleJob.run (node:internal/modules/esm/module_job:194:25)
file:///home/user/code/fr33split/dist/server.js:17744
workerPath: path.join(__dirname, '..', '..', 'worker-script', 'node', 'index.js'),
^

ReferenceError: __dirname 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/user/code/fr33split/package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.
at requireDefaultOptions (file:///home/user/code/fr33split/dist/server.js:17744:26)
at requireNode (file:///home/user/code/fr33split/dist/server.js:99541:25)
at requireCreateWorker (file:///home/user/code/fr33split/dist/server.js:99578:6)
at requireSrc (file:///home/user/code/fr33split/dist/server.js:100097:23)
at file:///home/user/code/fr33split/dist/server.js:100116:18
at ModuleJob.run (node:internal/modules/esm/module_job:194:25)
The error is easy enough to understand, but I can't figure out why it would not occur using dev. I also cannot find a solution to fix this. Any help is appreciated, thanks.
1 Reply
Alex Lohr
Alex Lohr16mo ago
In dev, everything is filtered through the dev server. In start, it attempts to run the last build. Did you build and if so, were there errors?
Want results from more Discord servers?
Add your server