Skip to content

Creating ts srcbook on windows #297

@WesBosman

Description

@WesBosman

When I boot up srcbook and click the button to create a typescript srcbook I get the following error on Windows.

Screenshot 2024-09-14 080432

This error led me to the node_modules/@srcbook/api/dist/tsserver/tsserver.mjs file. I noticed there was a call to spawn on line 37. If I add the option shell: true, to the spawn command then I don't get the error anymore.

const child = spawn('npx', ['tsserver'], {
  cwd:options.cwd,
  shell: true // added to make spawn call work
});

Now I'm able to create a typescript srcbook without generating an error. However when I start to type into the text area to create my typescript file I get another error. This error causes the local server to stop running.

Screenshot 2024-09-14 080828

I think this is an issue with the TextEncoder / TextDecoder in node_modules/@srcbook/api/dist/tsserver/messages.mjs.

I tried editing the carriage return char code thinking it was an issue with line endings in Windows but that didn't help.

// const CARRIAGE_RETURN_CHAR_CODE = '\r'.charCodeAt(0);
const CARRIAGE_RETURN_CHAR_CODE = '\r\n'.charcCodeAt();

I'm able to create javascript notebooks and run them without an issue. The issue only seems to happen with typescript notebooks.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions