Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating ts srcbook on windows #297

Open
WesBosman opened this issue Sep 14, 2024 · 7 comments · May be fixed by #444
Open

Creating ts srcbook on windows #297

WesBosman opened this issue Sep 14, 2024 · 7 comments · May be fixed by #444
Assignees
Labels
bug Something isn't working

Comments

@WesBosman
Copy link
Contributor

WesBosman commented Sep 14, 2024

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.

@versecafe
Copy link
Contributor

There's a few issues, a couple of spots not using path.join and the decoder is full of issues from windows using \r\n feel free to make a PR for this otherwise it'll get taken care of in the next few weeks

@versecafe versecafe added the bug Something isn't working label Sep 14, 2024
@WesBosman
Copy link
Contributor Author

I'll keep debugging. If I can make it through the decoder I'll make a PR.

@versecafe
Copy link
Contributor

If you end up needing help or have questions feel free to ping me Ben & Nick likely won't be checking on things until Monday

@qpenney
Copy link

qpenney commented Sep 15, 2024

+1

@nichochar
Copy link
Contributor

@WesBosman by the way if you're not in the Discord, that's a good place to have longer conversations about the bug / PR / questions. GitHub is fine too, but wanted to share in case you were interested.

@WesBosman
Copy link
Contributor Author

Hey @nichochar thanks! I've joined the discord.

@jaimedevelop
Copy link

jaimedevelop commented Nov 29, 2024

My recommendation for windows users like me is to install WSL or Windows Subsystem for Linux (WSL)(https://ubuntu.com/desktop/wsl). I expend a week trying to make the windows option to work and it did not. After installing WSL all the problems disappeared it. It runs perfect with WSL through the browser localhost in windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
5 participants