我正在尝试使用PHP制作cordova应用程序,而我正在使用MAC OS。问题是,当我尝试通过php / bash脚本或通过Python运行命令时,我收到此错误消息。
at require (internal/module.js:20:19)Array ( [0] => path.js:7 [1] =>
throw new TypeError('Path must be a string. Received ' +
inspect(path)); [2] => ^ [3] => [4] => TypeError: Path must be a
string. Received undefined [5] => at assertPath (path.js:7:11) [6]
=> at Object.join (path.js:1211:7) [7] => at Object. (/usr/local
/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova
/util.js:38:31) [8] => at Module._compile (module.js:571:32) [9] =>
at Object.Module._extensions..js (module.js:580:10) [10] => at
Module.load (module.js:488:32) [11] => at tryModuleLoad
(module.js:447:12) [12] => at Function.Module._load (module.js:439:3)
[13] => at Module.require (module.js:498:17) [14] => at require
(internal/module.js:20:19) )
如果我从bash或python运行脚本,那么相同的脚本运行顺利但是使用PHP Exec函数它会继续给我这个错误。
我正在运行这些命令
putenv('PATH='. getenv('PATH') .':/usr/local/bin');
print_r(exec("cordova create ppp 2>&1",$output,$return_val));
print_r($output);