help icon indicating copy to clipboard operation
help copied to clipboard

windows 11 unknown spawn error error code -4094

Open justincando opened this issue 3 years ago • 12 comments

Details

when running npx create-react-app my-app I get this error and it tells me to report this as a bug.

Node.js version

v16.14.2

Example code

npx create-react-app my-app

Operating system

windows 11

Scope

Installing packages. This might take a couple of minutes. Installing react, react-dom, and react-scripts with cra-template...

Aborting installation. Unexpected error. Please report it as a bug: Error: spawn UNKNOWN at ChildProcess.spawn (node:internal/child_process:413:11) at Object.spawn (node:child_process:700:9) at spawn (C:\Users\steel\AppData\Roaming\npm\node_modules\create-react-app\node_modules\cross-spawn\index.js:12:24) at C:\Users\steel\AppData\Roaming\npm\node_modules\create-react-app\createReactApp.js:390:19 at new Promise () at install (C:\Users\steel\AppData\Roaming\npm\node_modules\create-react-app\createReactApp.js:341:10) at C:\Users\steel\AppData\Roaming\npm\node_modules\create-react-app\createReactApp.js:468:16 at processTicksAndRejections (node:internal/process/task_queues:96:5) { errno: -4094, code: 'UNKNOWN', syscall: 'spawn' }

Deleting generated file... package.json Deleting my-app/ from D:\testreact Done.

Module and version

Not applicable.

justincando avatar Apr 07 '22 18:04 justincando

It looks like the child process failed to spawn an application. Can you provide some more context, that gives some more information?

rilysh avatar Apr 14 '22 02:04 rilysh

I have a similar problem when running unit tests with jest and the mongodb-memory-server package (https://github.com/nodkz/mongodb-memory-server).

When running a sample script starting the server (binaries fully downloaded, no local mongod instance running locally), I get a similar error like in the issue desription.

Node.js version v16.15.1

package.json { "devDependencies": { "nodemon": "^2.0.18", "ts-node": "^10.8.2", "typescript": "^4.7.4" }, "dependencies": { "mongodb-memory-server": "^8.7.2" }, "config": { "mongodbMemoryServer": { "debug": "1" } } }

Example code

import { MongoMemoryServer } from 'mongodb-memory-server';

(async () => {
    const mongod = await MongoMemoryServer.create();
    const uri = mongod.getUri();
    console.log('uri: ', uri);
    await mongod.stop();
})();

Log output

MongoMS:MongoMemoryServer Mongo[unknown]: _startUpInstance threw a Error: Error: spawn UNKNOWN at ChildProcess.spawn (node:internal/child_process:413:11) at spawn (node:child_process:700:9) at MongoInstance._launchMongod (C:\Users\user-name\Projects\testing\mongodb-memory-server\node_modules\mongodb-memory-server-core\src\util\MongoInstance.ts:443:31) at MongoInstance. (C:\Users\user-name\Projects\testing\mongodb-memory-server\node_modules\mongodb-memory-server-core\src\util\MongoInstance.ts:345:31) at Generator.next () at fulfilled (C:\Users\user-name\Projects\testing\mongodb-memory-server\node_modules\tslib\tslib.js:115:62) { errno: -4094, code: 'UNKNOWN', syscall: 'spawn' } +603ms MongoMS:MongoMemoryServer Mongo[unknown]: stop: Called .stop() method +10ms MongoMS:MongoMemoryServer Mongo[unknown]: stop: "instanceInfo" is not defined (never ran?) +0ms Error: spawn UNKNOWN at ChildProcess.spawn (node:internal/child_process:413:11) at spawn (node:child_process:700:9) at MongoInstance._launchMongod (C:\Users\user-name\Projects\testing\mongodb-memory-server\node_modules\mongodb-memory-server-core\src\util\MongoInstance.ts:443:31) at MongoInstance. (C:\Users\user-name\Projects\testing\mongodb-memory-server\node_modules\mongodb-memory-server-core\src\util\MongoInstance.ts:345:31) at Generator.next () at fulfilled (C:\Users\user-name\Projects\testing\mongodb-memory-server\node_modules\tslib\tslib.js:115:62) { errno: -4094, code: 'UNKNOWN', syscall: 'spawn' }

stefanO2602 avatar Jul 11 '22 13:07 stefanO2602

Also seeing this on Parallels Windows 11

o0101 avatar Feb 07 '23 16:02 o0101

I have the same issue, one time when I tried to build an Electron app with --watch, and at the same time, when running a subprocess while building a Python app, it seemed like a local issue, maybe related to 'win error' 225

idodidodi avatar Feb 23 '23 18:02 idodidodi

Has anyone been able to resolve their issue? We're running into a simular issue when running unit tests in our pipelines...

juleskreutzer avatar May 03 '23 11:05 juleskreutzer

In my case, I was running the same commands for months and it worked perfectly fine. Suddenly it stopped working, and I received the spawn error message. My colleagues who were using the same code didn’t experience it.

The only thing the solved that issue was to format my PC.

On Wed, 3 May 2023 at 14:32 Jules Kreutzer @.***> wrote:

Has anyone been able to resolve their issue? We're running into a simular issue when running unit tests in our pipelines...

— Reply to this email directly, view it on GitHub https://github.com/nodejs/help/issues/3819#issuecomment-1532870867, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADDUWPG7QFNBZ7FOEZBT27LXEI66VANCNFSM5S2FFQVA . You are receiving this because you commented.Message ID: @.***>

--

עידו

idodidodi avatar May 03 '23 16:05 idodidodi

Thanks for the reply. We’re currently facing this issue in Azure Pipelines. Changing the vmImage used doesn’t have any effect. Local it works as expectedMet vriendelijke groet, Jules KreutzerOp 3 mei 2023 om 18:09 heeft Ido Ayal @.***> het volgende geschreven: In my case, I was running the same commands for months and it worked perfectly fine. Suddenly it stopped working, and I received the spawn error message. My colleagues who were using the same code didn’t experience it.

The only thing the solved that issue was to format my PC.

On Wed, 3 May 2023 at 14:32 Jules Kreutzer @.***> wrote:

Has anyone been able to resolve their issue? We're running into a simular issue when running unit tests in our pipelines...

— Reply to this email directly, view it on GitHub https://github.com/nodejs/help/issues/3819#issuecomment-1532870867, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADDUWPG7QFNBZ7FOEZBT27LXEI66VANCNFSM5S2FFQVA . You are receiving this because you commented.Message ID: @.***>

--

עידו

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>

juleskreutzer avatar May 03 '23 16:05 juleskreutzer

I think a wrapper batch script may be missing. And the script tries to run a js file with execFileSync.

Let's consider these scripts:

log.js

#!/usr/bin/env node
console.log("log.js");

test.js

const { execFileSync  } = require('child_process');
const cmd = 'C:\\pathto\\log.js';  //on ubuntu '/pathto/log.js'
execFileSync(cmd, {stdio: 'inherit'});

if you run the test.js in Windows you will get this error: Error: spawnSync C:\pathto\log.js UNKNOWN

if you run the test.js on Unix-like platforms it will run

https://stackoverflow.com/a/33510581 https://stackoverflow.com/questions/37585966/node-modules-bin-package-cmd-file-in-node-js/44468968#44468968

pogiaron avatar Feb 04 '24 21:02 pogiaron