无法使用./子进程Node JS运行应用程序

时间:2020-10-21 18:39:26

标签: javascript node.js ngrok

我正在尝试使用Node JS子进程启动Ngrok,不幸的是,这没有用,因为它认为./是无法识别的命令...我该如何解决?它可以在我所在目录中的终端上运行...

const os = new os_func()

os.execCommand(`./ngrok http file:///my-file`).then(res => {
  console.log(res)
}).catch(err => {
  console.log(err)
})

我的OS功能公开并导出为...

function os_func() {
  this.execCommand = function (cmd) {
    return new Promise((resolve, reject) => {
      exec(cmd, (error, stdout, stderr) => {
        if (error) {
          reject(error)
          return
        }
        resolve(stdout)
      })
    })
  }
}

我得到的错误是:

'。不被识别为内部或外部命令

0 个答案:

没有答案