child-process

Node Child Process Exec Command Failed with error code 1

扶醉桌前 提交于 2020-08-26 16:30:28
问题 I am trying to execute some line using node js child process and getting error. Following is my code: let cmd : string = "code " + PROJECTS[value]; exec(cmd, function callback(error, stdout, stderr) { console.log("started console app"); }); ERROR : cmd:"C:\WINDOWS\system32\cmd.exe /s /c "code c:\Users\shana\Dropbox\code-settings-syn... (length: 82)" code:1 killed:false message:"Command failed: C:\WINDOWS\system32\cmd.exe /s /c "code c:\Users\shana\Dropbox\c... (length: 99)" signal:null stack

Node Child Process Exec Command Failed with error code 1

狂风中的少年 提交于 2020-08-26 16:27:49
问题 I am trying to execute some line using node js child process and getting error. Following is my code: let cmd : string = "code " + PROJECTS[value]; exec(cmd, function callback(error, stdout, stderr) { console.log("started console app"); }); ERROR : cmd:"C:\WINDOWS\system32\cmd.exe /s /c "code c:\Users\shana\Dropbox\code-settings-syn... (length: 82)" code:1 killed:false message:"Command failed: C:\WINDOWS\system32\cmd.exe /s /c "code c:\Users\shana\Dropbox\c... (length: 99)" signal:null stack

NodeJs Error: spawn C:\Windows\system32\cmd.exe; ENOENT

对着背影说爱祢 提交于 2020-08-03 09:11:40
问题 This is my script : var exec = require('child_process').exec; exec('dir', function(error, stdout, stderr) { // 'dir' is for example if (error) { console.error(`exec error: ${error}`); return; } console.log(`stdout: ${stdout}`); console.log(`stderr: ${stderr}`); }); And in the console I have : exec error: Error: spawn C:\Windows\system32\cmd.exe; ENOENT Someone can help me ? 回答1: I got to resolve the issue the problem is to remove the semicolon(;) from an end of the ComSpec path C:\Windows

NodeJs Error: spawn C:\Windows\system32\cmd.exe; ENOENT

偶尔善良 提交于 2020-08-03 09:11:22
问题 This is my script : var exec = require('child_process').exec; exec('dir', function(error, stdout, stderr) { // 'dir' is for example if (error) { console.error(`exec error: ${error}`); return; } console.log(`stdout: ${stdout}`); console.log(`stderr: ${stderr}`); }); And in the console I have : exec error: Error: spawn C:\Windows\system32\cmd.exe; ENOENT Someone can help me ? 回答1: I got to resolve the issue the problem is to remove the semicolon(;) from an end of the ComSpec path C:\Windows