![](/img/trans.png)
[英]'cocos' is not recognized as an internal or external command, operable program or batch file
[英]'.' is not recognized as an internal or external command, operable program or batch file
我似乎有一個簡單的問題:)
gulp.task('js', function () {
return gulp.src('.').pipe(exec('./node_modules/requirejs/bin/r.js -o rconfig.js'));
});
在這部分代碼中,我得到下一個錯誤:
命令失敗:./node_modules/requirejs/bin/r.js -o rconfig.js
'' 不被識別為內部或外部命令,可操作程序或批處理文件。
細節:
killed: false code: 1 signal: null cmd: ./node_modules/requirejs/bin/r.js -o rconfig.js
我認為這是發生問題的原因,因為我有gulp.src('。'),根據此規范https://github.com/robrich/gulp-exec認為不正確。
如果我將gulp.src('。')更改為gulp.src('./'),它也不會修復。
在此示例中,請勿使用gulp-exec
,而應使用exec
:
var exec = require('child_process').exec;
gulp.task('js', function (cb) {
exec(
'./node_modules/requirejs/bin/r.js -o rconfig.js',
function (err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
cb(err);
);
});
在他們的文檔中如此說。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.