Azure / azure-functions-core-tools

Command line tools for Azure Functions
MIT License
1.33k stars 437 forks source link

Node 20.11 error: spawn Unknown system error #3610

Open SwapnilJavanjal opened 9 months ago

SwapnilJavanjal commented 9 months ago

C:\users\\>func init --worker-runtime node node:internal/child_process:421 throw errnoException(err, 'spawn'); ^

Error: spawn UNKNOWN at ChildProcess.spawn (node:internal/child_process:421:11) at spawn (node:child_process:761:9) at main (C:\Users\user_name\AppData\Roaming\npm\node_modules\azure-functions-core-tools\lib\main.js:9:22) at Object. (C:\Users\user_name\AppData\Roaming\npm\node_modules\azure-functions-core-tools\lib\main.js:18:1) at Module._compile (node:internal/modules/cjs/loader:1376:14) at Module._extensions..js (node:internal/modules/cjs/loader:1435:10) at Module.load (node:internal/modules/cjs/loader:1207:32) at Module._load (node:internal/modules/cjs/loader:1023:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12) at node:internal/main/run_main_module:28:49 { errno: -4094, code: 'UNKNOWN', syscall: 'spawn' }

Node.js v20.11.1 OS: Windows 11 CPU: I7

plettj commented 8 months ago

Running into the same issue:

C:\Users\user_name\<project_name>> func init nameOfFunctionApp --javascript
node:internal/child_process:421
    throw errnoException(err, 'spawn');
    ^

Error: spawn UNKNOWN
    at ChildProcess.spawn (node:internal/child_process:421:11)
    at spawn (node:child_process:761:9)
    at main (C:\Users\user_name\AppData\Roaming\npm\node_modules\azure-functions-core-tools\lib\main.js:9:22)
    at Object.<anonymous> (C:\Users\user_name\AppData\Roaming\npm\node_modules\azure-functions-core-tools\lib\main.js:18:1)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
    at node:internal/main/run_main_module:28:49 {
  errno: -4094,
  code: 'UNKNOWN',
  syscall: 'spawn'
}

Node.js v20.11.0 OS: Windows 11 CPU: I7

plettj commented 8 months ago

Also fails when using Node.js v18.18.0 and Node.js v10.24.1.

TriceratopsEgg commented 6 months ago

I ran into this issue today and resolved it as follows:

In the host.json file of my solution I changed the field under extensionBundle > version from [3.3.0, 4.0.0) to [3.*, 4.0.0)

-AND-

Installed the azure-functions-core-tools library locally instead of globally.

I am not certain why these actions made the difference but I can run the function now and I hope it helps others.