mattdesl / canvas-sketch

[beta] A framework for making generative artwork in JavaScript and the browser.
MIT License
4.96k stars 393 forks source link

Error: spawn EINVAL #199

Open pavel-101 opened 2 months ago

pavel-101 commented 2 months ago

Hi,

I'm really new to coding so please bare with me. :) I just installed canvas-sketch and node.js. When I trying to create a new sketch with canvas-sketch i get: Error: spawn EINVAL at ChildProcess.spawn (node:internal/child_process:421:11) at spawn (node:child_process:761:9) at command (C:\Sketches\node_modules\spawn-npm-install\index.js:45:14) at Array. (C:\Sketches\node_modules\install-if-needed\index.js:47:9) at runSeries (C:\Sketches\node_modules\run-series\index.js:23:33) at run (C:\Sketches\node_modules\install-if-needed\index.js:52:5) at C:\Sketches\node_modules\read-closest-package\index.js:29:7

I'm running on: Windows 11 Home node v20.12.2 npm 10.5.0

Tried: The suggestion in this post Install globally, run with npx and --save-dev. All attempts gives same result,

After searching a bit more i came across this post which talks about a security update to node. I wonder if this is what's causing the issue? If not how, can i get it to work?

SonoDavid commented 2 months ago

You can fix it by going to C:\Sketches\node_modules\spawn-npm-install\index.js and changing the lines 36 to 40 to this:

  var spawnArgs = {
    shell: true,
    cwd: opt.cwd,
    env: opt.env || process.env,
    stdio: opt.stdio
  }

adding shell: true to the parameters.

I seems like the folder was downloaded from this repo: https://github.com/mattdesl/spawn-npm-install.

pavel-101 commented 2 months ago

Thank you @SonoDavid for your help, it worked!