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

Error: spawn EINVAL #199

Open
pavel-101 opened this issue Apr 30, 2024 · 4 comments
Open

Error: spawn EINVAL #199

pavel-101 opened this issue Apr 30, 2024 · 4 comments

Comments

@pavel-101
Copy link

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
Copy link

SonoDavid commented May 5, 2024

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
Copy link
Author

Thank you @SonoDavid for your help, it worked!

@Dellangelo-graphic
Copy link

Hi, I've got the same problem but with one exception: I don't have the note_modules folder :(
I don't know why the program didn't create that. I'm also new in coding please help :(
Thank you anticipated!

@mattdesl
Copy link
Owner

Hey all, I've just changed a feature that may help fix this problem even when node version is >= 18. Unfortunately I don't have access to Windows right now to test.

Can you try updating the CLI?

If you are using it globally:

npm i canvas-sketch-cli@1.15.0 --global

mkdir test-sketch
cd test-sketch
canvas-sketch sketch.js --new

Or if you are using it with npx:

mkdir test-sketch
cd test-sketch
npx canvas-sketch-cli@1.15.0 sketch.js --new

Or if you are using it with locally installed devDependency:

mkdir test-sketch
cd test-sketch
npm init -y

npm install canvas-sketch-cli@1.15.0 --save-dev
npx canvas-sketch sketch.js --new

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

4 participants