Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/286.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
可以使用PHP';s exec()是否运行节点模块?_Php_Npm_Exec_Google Slides Api - Fatal编程技术网

可以使用PHP';s exec()是否运行节点模块?

可以使用PHP';s exec()是否运行节点模块?,php,npm,exec,google-slides-api,Php,Npm,Exec,Google Slides Api,我想使用exec()函数在PHP页面上显示命令的输出。如果我在ubuntu的终端上运行这个命令,它运行得很好,但不是在PHP代码中。md2gslides是一个库,它使用google slides API将.md(markdown)文件转换为google幻灯片。我使用npm安装了md2gslides。下面是我写的一段代码: $output=array(); exec('"/home/user/.npm-global/bin/md2gslides" "/var/www/

我想使用
exec()
函数在PHP页面上显示命令的输出。如果我在ubuntu的终端上运行这个命令,它运行得很好,但不是在PHP代码中。md2gslides是一个库,它使用google slides API将.md(markdown)文件转换为google幻灯片。我使用npm安装了md2gslides。下面是我写的一段代码:

$output=array();
exec('"/home/user/.npm-global/bin/md2gslides" "/var/www/html/test/files/slides.md" --copy=1z3XLhVWc03U3deHy --title "Test Slide" --no-browser 2>&1', $output);
print_r($output);
感谢您的帮助

以下是错误:

Array
(
[0] => internal/validators.js:125
[1] => throw new ERR_INVALID_ARG_TYPE(name, 'string', value);
[2] => ^
[3] =>
[4] => TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined
[5] => at validateString (internal/validators.js:125:11)
[6] => at Object.join (path.js:1147:7)
[7] => at Object. (/home/user/.npm-global/lib/node_modules/md2gslides/bin/md2gslides.js:33:38)
[8] => at Module._compile (internal/modules/cjs/loader.js:778:30)
[9] => at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
[10] => at Module.load (internal/modules/cjs/loader.js:653:32)
[11] => at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
[12] => at Function.Module._load (internal/modules/cjs/loader.js:585:3)
[13] => at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
[14] => at startup (internal/bootstrap/node.js:283:19)
[15] => at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
)

这里有什么提示吗?

似乎缺少用户提供的局部变量路径?我不明白。您指的是哪个局部变量路径?unix shell。。。TypeError[ERR_INVALID_ARG_TYPE]:“path”参数必须是string类型。接收到的类型未定义。。。但没关系,我猜这是第一个参数。。。您不需要在参数和二进制之间加引号。。试着删除双引号。这也不起作用。似乎它缺少用户的局部变量路径?我不明白。您指的是哪个局部变量路径?unix shell。。。TypeError[ERR_INVALID_ARG_TYPE]:“path”参数必须是string类型。接收到的类型未定义。。。但没关系,我猜这是第一个参数。。。您不需要在参数和二进制之间加引号。。试着去掉双引号,那也不行。