Closed 500-internal-server-error closed 3 months ago
You're trying to compile 670 kB of minified JS. What's the issue here?
@500-internal-server-error try this:
NODE_OPTIONS='--max-old-space-size=16384' npx deno2node
@KnorpelSenf I would rather not install an entire new JS runtime just because the authors of the JS script I'm trying to run wrote it for a different runtime.
@trgwii Thanks, that seems to run without OOM crashes now. But now it's crashing elsewhere in the dependencies.
username@localhost:~ $ NODE_OPTIONS='--max-old-space-size=16384' npx deno2node
Loading tsconfig: 326.632ms
Basic transformations: 4.138s
Emitting: 1.209s
C:\Users\User\temp\deno\node_modules\@ts-morph\common\dist\typescript.js:120094
output += formatCodeSpan(diagnostic.file, diagnostic.start, diagnostic.length, "", getCategoryFormat(diagnostic.category), host);
^
RangeError: Invalid string length
at Object.formatDiagnosticsWithColorAndContext (C:\Users\User\temp\deno\node_modules\@ts-morph\common\dist\typescript.js:120094:19)
at Project.formatDiagnosticsWithColorAndContext (C:\Users\User\temp\deno\node_modules\ts-morph\dist\ts-morph.js:20711:26)
at file:///C:/Users/User/temp/deno/node_modules/deno2node/lib/cli.js:35:30
Node.js v22.1.0
I thought the "string length" may be related to Windows' MAX_PATH
(I've had that problem in the past), but subst
to a shorter path didn't help.
@500-internal-server-error where from do you take the script? Which tool is it?
@KnorpelSenf
cli.ts
was obtained from here
RangeError: Invalid string length
means the output JS string is too long for your JS engine to be able to represent it. So I guess something is causing an infinite loop.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length
Diagnostics are simply too long. Try transforming the source instead.
@wojpawlik Ah, the source makes use of deno modules. So I guess I'd have to rewrite it by hand anyway. Unless resolving deno dependencies is something this tool handles?
@KnorpelSenf
cli.ts
was obtained from here
That is just some build output. Where's the original source? Is there a repo?
I found the CLI that created it at https://github.com/FabricMC/fabricmc.net but that doesn't reveal the input source
You're too slow :) It'd be nice if deno2node
could auto-detect deno.jsonc?
's "vendor": true
... but I'm not enthusiastic about dealing with 2nd config file.
...just to allow omitting one line in existing config file.
I installed and ran from npm as instructed in the README:
cli.ts
was obtained from here.Running on Windows 11 x64 with 32GB of RAM, in case it matters.