简体   繁体   English

NodeJS无法转到该文件夹​​以执行child_process.spawn中的命令

[英]NodeJS can not go to the folder up to execute the command from child_process.spawn

To start WebPack (which is in the parent folder) I use Gulp, but as soon as I try to go to the parent folder in the path, I get an error. 要启动WebPack(位于父文件夹中),我使用Gulp,但是一旦我尝试转到路径中的父文件夹,就会出现错误。

Gulp 古尔普

var spawn = require('child_process').spawn;

gulp.task('_Scada2', function (done) {
  spawn('webpack', [], { cwd: '../../Scada.Web/' })
    .on('close', done);
});

get an error 得到一个错误

[14:20:47] '_Scada2' errored after 4.47 ms
[14:20:47] Error: spawn webpack ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:229:19)
    at onErrorNT (internal/child_process.js:406:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
Процесс завершен с кодом 1.

尝试__dirname + '../../Scada.Web/'

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 NodeJs:检测以child_process.spawn启动的程序何时准备就绪? - NodeJs: Detect when program started with child_process.spawn is ready? node.js脚本中的child_process.spawn ENOENT问题 - child_process.spawn ENOENT issue in nodejs script nodejs:child_process.spawn不报告退出代码 - nodejs: child_process.spawn not reporting exit code 从child_process.spawn访问过程对象 - Accessing process object from child_process.spawn 在Windows OS上使用child_process.spawn启动bat时如何从NodeJS获取输出,并且该bat将打开一个新终端 - How to get the output from NodeJS when use the child_process.spawn to launch a bat on windows OS, and the bat will open a new terminal 奇怪的输出“ - Weird output "<Buffer" in child_process.spawn 外壳程序命令child_process.spawn(command,[args],[options])node.js - shell command to child_process.spawn(command, [args], [options]) node.js 当其中一个args中有一个空格时,nodeJS child_process.spawn不起作用 - nodeJS child_process.spawn does not work when one of the args has a space in it 在通过child_process.spawn()运行的脚本中,如何从依赖项中省略stdout数据,而仅包含我想要的内容? - In a script running via child_process.spawn(), how can I omit stdout data from dependencies and only include what I want? 当将child_process.spawn()方法与{stdio:&#39;inherit&#39;}一起使用时,父级是否有可能从子进程接收输出? - When using the child_process.spawn() method with {stdio: 'inherit'}, is it possible for the parent receive output from the child process?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM