Closed ufo512 closed 1 year ago
Hi @ufo512,
Thanks for reaching out. It seems like you trying to build from the main
branch, which may not be working on Windows. Can you please try to build from the latest release: https://github.com/leafac/kill-the-newsletter/tree/v1.0.1
Please let me know how it goes.
Thanks for your answer @leafac. I tried to build both from the main
branch and v1.0.1
release, and I always got the same error.
Hmmm, thanks for trying. I’ll look into this and get back to you.
Thank you!
I rolled back the @leafac/html package to 3.0.0 and packaged it with pkg and the error disappeared. The problem is still not solved though, because when I package it with caxa, this error still pops up. Is it possiple to force caxa to use a particular version of a package?
@ufo512
caxa isn’t supposed to change the versions of packages. It’ll run npm dedupe --production
, so just make sure you’re changing package versions in package.json
, not just changing the contents of the node_modules/
folder.
But really, we need to figure out the underlying issue. I’ll get to it at some point, but please continue digging and report back on what you find 😁
I decided to go with pkg as I finally got it working and I'm not that familiar with node and TS to do that with caxa 😕
@ufo512 Oh, good to know that pkg works with Kill the Newsletter! 😀
I suppose we’re closing this issue for now. If you want to follow-up on something feel free to reopen it.
I am able to run kill-the-newsletter locally with node, but I want to compile it to exe to put it on Digital Ocean. I'm on Windows 10. After installing caxa, I tried to make an exe file with this command:
npx caxa --directory . --command "{{caxa}}/node_modules/.bin/node" "{{caxa}}/lib" --output ktn.exe
It created the exe but when I try to run it, it throws an error:
`internal/modules/cjs/loader.js:1089 throw new ERR_REQUIRE_ESM(filename, parentPath, packageJsonPath); ^
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: C:\Users\Dell\AppData\Local\Temp\caxa\ktn\kerfwv1oby\node_modules\@leafac\html\distribution\index.js require() of ES modules is not supported. require() of C:\Users\Dell\AppData\Local\Temp\caxa\ktn\kerfwv1oby\node_modules\@leafac\html\distribution\index.js from C:\Users\Dell\AppData\Local\Temp\caxa\ktn\kerfwv1oby\lib\index.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules. Instead rename C:\Users\Dell\AppData\Local\Temp\caxa\ktn\kerfwv1oby\node_modules\@leafac\html\distribution\index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from C:\Users\Dell\AppData\Local\Temp\caxa\ktn\kerfwv1oby\node_modules\@leafac\html\package.json.
code: 'ERR_REQUIRE_ESM' }`
What can I do to solve it? I tried downgrading node-fetch as this post suggested but it didn't help.