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

Unhandled 'error' event #314

Open
Horadrim opened this issue Sep 19, 2024 · 7 comments
Open

Unhandled 'error' event #314

Horadrim opened this issue Sep 19, 2024 · 7 comments

Comments

@Horadrim
Copy link

Steps to reproduce:

  1. Globally install srcbook with npm
  2. Start the application
  3. Click "Create Srcbook"
  4. Upon writing a new title or pasting / writing any code, the application crashes.

Console output:

`
Srcbook
Serving static files (React app)...
Creating WebSocket server...
Initialization complete
srcbook@0.0.6 running at http://localhost:2150
node:events:497
throw er; // Unhandled 'error' event
^

Error: spawn npx ENOENT
at ChildProcess._handle.onexit (node:internal/child_process:286:19)
at onErrorNT (node:internal/child_process:484:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Emitted 'error' event on ChildProcess instance at:
at ChildProcess._handle.onexit (node:internal/child_process:292:12)
at onErrorNT (node:internal/child_process:484:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
errno: -4058,
code: 'ENOENT',
syscall: 'spawn npx',
path: 'npx',
spawnargs: [ 'tsserver' ]
}

Node.js v20.16.0
`

@benjreinhart
Copy link
Contributor

benjreinhart commented Sep 19, 2024

Hmm, I cannot seem to reproduce. I'm on mac, using chrome, deleted all my srcbook files (so, clean slate) and then ran:

npm i -g srcbook
srcbook start

This installed and booted srcbook@0.0.6.

I created a srcbook, entered a title, no crash. Then I tried writing code (without installing deps), no crash.

@Sanjoy-droid
Copy link
Contributor

@Horadrim Hmm, me to, I am on Ubuntu, using brave, working fine, not able to reproduce this issue

@Cam-Bread
Copy link

I am getting the same error on Windows. I dug into it a bit and found its because of the difference in how windows handles the spawn call. it looks like it needs the option "shell" set to true for windows to be able to run tsserver:

 const child = spawn('npx', ['tsserver'], {
        cwd: options.cwd,
        shell: process.platform == 'win32',
 });

unfortunately it seems like there may still be other issues as am still unable to successfully run typescript cell code even after that change. But hopefully this gives you all a good starting point to supporting windows as well if you decide to do so :)

@Horadrim
Copy link
Author

I forgot to mention that I'm using windows 11. I guess since the other guys can't reproduce it on Linux and Mac, seems to be a Windows only issue indeed.

@versecafe
Copy link
Contributor

@Cam-Bread Windows TS code is under the work it's just some extra work with windows white spacing in validators and a few places left not using path.join()

@nelslar42
Copy link

has this been resolved? im having the same issues on Windows

npx srcbook@latest start
Srcbook
Serving static files (React app)...
Creating WebSocket server...
Initialization complete
srcbook@0.0.14 running at http://localhost:2150
Error: spawn npm ENOENT
at ChildProcess._handle.onexit (node:internal/child_process:286:19)
at onErrorNT (node:internal/child_process:484:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
errno: -4058,
code: 'ENOENT',
syscall: 'spawn npm',
path: 'npm',
spawnargs: [ 'install', '--include=dev' ]
}
node:internal/process/promises:391
triggerUncaughtException(err, true /* fromPromise */);
^

@nichochar
Copy link
Contributor

Unfortunately windows support is not ready yet. We're working hard to ship a hosted version right now which will make Srcbook usable online making these platform issues less of a pain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants