javascript - 无法使用 ./ 子进程 Node JS 运行应用程序
问题描述
我正在尝试使用子进程的 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)
})
我的操作系统功能被公开并导出为...
function os_func() {
this.execCommand = function (cmd) {
return new Promise((resolve, reject) => {
exec(cmd, (error, stdout, stderr) => {
if (error) {
reject(error)
return
}
resolve(stdout)
})
})
}
}
我得到的错误是:
'。' 未被识别为内部或外部命令
解决方案
推荐阅读
- jquery - 如何将 jquery 放在 laravel 控制器上?
- javascript - 在 ie11 上使用 reactjs,在生产中使用空白页面,但如果检查器打开,则页面加载正常
- javascript - 如何使用javascript或jquery在输入中一个接一个地添加多个值?
- python - 如何访问熊猫中的一行?
- loops - 如何使用 Kotlin 将 mutableList 循环到 Android 通知中的多行?
- reactjs - 我可以忽略 useContext 的详尽警告吗?
- processing - 处理IDE的显示问题,运行后,文本消失了
- java - 带有 Spring-boot 的 Kafka:消费者通过 ConsumerRecord 使用 java.lang.Object(任何/所有对象)
- javascript - Firebase NodeJS 身份验证登录问题
- amazon-web-services - 如何解决 sudo yum update 错误