nukeop / nuclear

Streaming music player that finds free music for you
https://nuclear.js.org/
GNU Affero General Public License v3.0
11.72k stars 1.02k forks source link

npm install fails on Windows for latest nodejs versions #1622

Closed saimfd closed 3 days ago

saimfd commented 4 days ago

Platform: Windows 10

Nuclear version: 0.6.30

Description of the issue:

npm install on Windows failed with this error while building deasync:

npm error code 1
npm error path E:\Projects\nuclear\node_modules\deasync
npm error command failed
npm error command C:\WINDOWS\system32\cmd.exe /d /s /c node ./build.js
npm error node:internal/child_process:421
npm error     throw new ErrnoException(err, 'spawn');
npm error     ^
npm error
npm error Error: spawn EINVAL
npm error     at ChildProcess.spawn (node:internal/child_process:421:11)
npm error     at Object.spawn (node:child_process:760:9)
npm error     at build (E:\Projects\nuclear\node_modules\deasync\build.js:77:6)
npm error     at Object.<anonymous> (E:\Projects\nuclear\node_modules\deasync\build.js:69:5)
npm error     at Module._compile (node:internal/modules/cjs/loader:1460:14)
npm error     at Module._extensions..js (node:internal/modules/cjs/loader:1544:10)
npm error     at Module.load (node:internal/modules/cjs/loader:1275:32)
npm error     at Module._load (node:internal/modules/cjs/loader:1091:12)
npm error     at wrapModuleLoad (node:internal/modules/cjs/loader:212:19)
npm error     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:158:5) {
npm error   errno: -4071,
npm error   code: 'EINVAL',
npm error   syscall: 'spawn'
npm error }
npm error
npm error Node.js v22.3.0
npm error A complete log of this run can be found in: C:\Users\Admin\AppData\Local\npm-cache\_logs\2024-07-01T09_18_08_159Z-debug-0.log

Upon investigation, I found that this error is because of this security update by NodeJS:

https://nodejs.org/en/blog/vulnerability/april-2024-security-releases-2

It works fine for Node versions that were released prior to this update.

This issue is fixed in 0.1.30 version of deasync but nuclear is currently on version 0.1.28. I updated the version of deasync locally and everything worked perfectly.

I can open a PR for this.

nukeop commented 4 days ago

Awesome, that would be amazing. I was (unsuccessfully) trying to fix this on this branch: https://github.com/nukeop/nuclear/tree/fix/windows-build

And for some reason I had to reorganize half of the project and couldn't get to the bottom of it regardless. You'd be saving me a HUGE headache with that PR.

saimfd commented 4 days ago

@nukeop Great, I will open a PR for this

saimfd commented 4 days ago

@nukeop One thing I noticed is that, sqlite3 was downgraded to 5.1.6 but it wasnt reflected in package-lock. Is this intentional?

nukeop commented 3 days ago

It should be locked to 5.1.6. This is because there's a problem with building 5.1.7: https://github.com/TryGhost/node-sqlite3/issues/1748

nukeop commented 3 days ago

BTW, everything on that branch I linked can be simply discarded if you can make it work in a different way.

saimfd commented 3 days ago

Ok great. I am working from my own branch, not using the linked one.