shuttle-hq / shuttle-examples

Examples for using Shuttle with different frameworks and resources
https://www.shuttle.rs
147 stars 59 forks source link

Bug: 'Error: spawn EINVAL' #175

Closed Ancientkingg closed 4 months ago

Ancientkingg commented 4 months ago

Platform

Microsoft Windows NT 10.0.19045.0 x64

Template

fullstack-templates/saas

How to reproduce?

  1. cargo shuttle init
  2. Select the fullstack-templates/saas template
  3. npm install
  4. npm run dev

What happens?

According to the roarr logs, the front-end fails to build, giving the error Error: spawn EINVAL.

Why did this happen?

After some investigation, this particular issue is related to the turbowatch.ts file.

The command fails to run due to a patch in node introduced by 69ffc6d. A thread can be found here about the issue. It seems like node prevents spawning .cmd files.

Suggested fix

As mentioned by this comment, a simple fix would be to use { shell: true } when spawning the command.

Logs

{"context":{"package":"turbowatch","namespace":"subscribe","logLevel":40,"error":{"errno":-4071,"code":"EINVAL","syscall":"spawn","name":"Error","message":"spawn EINVAL","stack":"Error: spawn EINVAL\n    at ChildProcess.spawn (node:internal/child_process:421:11)\n    at spawn (node:child_process:760:9)\n    at C:\\Users\\xxx\\Documents\\yyy\\turbowatch.ts:19:40\n    at new Promise (<anonymous>)\n    at executeCommand (C:\\Users\\xxx\\Documents\\yyy\\turbowatch.ts:11:10)\n    at Object.onChange (C:\\Users\\xxx\\Documents\\yyy\\turbowatch.ts:108:13)\n    at runTask (C:\\Users\\xxx\\Documents\\yyy\\node_modules\\turbowatch\\dist\\subscribe.js:55:21)\n    at handleSubscriptionEvent (C:\\Users\\xxx\\Documents\\yyy\\node_modules\\turbowatch\\dist\\subscribe.js:179:25)\n    at Object.trigger (C:\\Users\\xxx\\Documents\\yyy\\node_modules\\turbowatch\\dist\\subscribe.js:246:15)\n    at evaluateSubscribers.noLeading (C:\\Users\\xxx\\Documents\\yyy\\node_modules\\turbowatch\\dist\\createFileChangeQueue.js:47:35)\n    at Timeout.exec [as _onTimeout] (C:\\Users\\xxx\\Documents\\yyy\\node_modules\\throttle-debounce\\cjs\\index.js:85:16)\n    at listOnTimeout (node:internal/timers:573:17)\n    at process.processTimers (node:internal/timers:514:7)"}},"message":"frontend (4a3ec8fe): routine produced an error","sequence":"23","time":1720461659493,"version":"2.0.0"}