Trouble running RacketScript outside of playground

Hi, all. I'm trying to port a project I made to RacketScript. While everything in the playground works great I'm unable to run the JS outside the playground. Here's a minimal example:

#lang racket

(require racketscript/htdp/image
         racketscript/htdp/universe
         racketscript/interop)

(print-image (text "Hello, world!" 32 "black"))

Produces:

import * as $rjs_core from '../runtime/core.js';
import * as M0 from "../links/racketscript-extras/racketscript/htdp/image.rkt.js";
import * as M1 from "../runtime/kernel.rkt.js";
import * as M2 from "../collects/racket/private/modbeg.rkt.js";
M1.call_with_values(function() {
  if (arguments.length !== 0) {
    throw $rjs_core.racketContractError("arity mismatch");
  } else {}
  return M0.print_image(M0.text($rjs_core.UString.make("Hello, world!"), 32, $rjs_core.UString.make("black")));
}, M2.__rjs_quoted__.print_values);
var __rjs_quoted__ = {};
export {
  __rjs_quoted__
};

Which gives error:

struct.js:222 Uncaught TypeError: Cannot read properties of undefined (reading 'attachToStructTypeDescriptor')
    at new StructTypeDescriptor (struct.js:222:25)
    at Module.makeStructType (struct.js:525:24)
    at Module.make_struct_type (kernel.rkt.js:1:25192)
    at kw.rkt.js:1:12048

I just confirmed that the problem occurs with the code generated by (text "hello, world" 32 "black").

Has anyone seen this before?

2 Likes

Hello,

Yes, I've seen this error before. In my case it's related to upgrading to Racket 8.7. What version of Racket are you using?

I'm working on Racket 8.7 compatibility, so hopefully we'll have a fix soon.

1 Like

I'm using 8.7, so that's got to be it. Thanks!

We merged a fix for 8.7, if you update RacketScript that error should be resolved now :+1:

1 Like