2017-12-18 181 views
1

當我試圖讓gulp --production我得到這個錯誤:錯誤約vue.js出現時儘量讓一口生產

[14:27:45] Using gulpfile ~/www/webpage/gulpfile.js 
[14:27:45] Starting 'all'... 
[14:27:45] Starting 'task'... 
[14:27:45] Starting 'js-langs'... 
[14:27:45] Finished 'task' after 8.53 ms 
[14:27:45] Starting 'webpack'... 
events.js:141 
     throw er; // Unhandled 'error' event 
    ^

Error: spawn php artisan vue-i18n:generate ENOENT 
    at exports._errnoException (util.js:870:11) 
    at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32) 
    at onErrorNT (internal/child_process.js:344:16) 
    at nextTickCallbackWith2Args (node.js:441:9) 
    at process._tickCallback (node.js:355:17) 
    at Function.Module.runMain (module.js:444:11) 
    at startup (node.js:136:18) 
    at node.js:966:3 

似乎有與Vue的任何一個問題,知道如何解決它?

我試圖找到有關錯誤的信息,如果我發現它,我也會在這裏發佈它。

,使錯誤的gulpfile內部的線路是這樣的:

gulp.task('js-langs', shell.task([ 
    "php artisan vue-i18n:generate", 
])); 

如果我試圖讓php artisan vue-i18n:generate在終端,我得到這樣的:

Written to /home/lluisdev/www/webpage/resources/assets/js/lib/locales/vue-i18n-locales.generated.js

gulpfile

enter image description here

+0

看起來它試圖運行'php artisan vue-i18n:generate'作爲構建步驟。如果你通過CLI直接運行它,它會起作用嗎? – ceejayoz

+0

你好@ceejayoz我試過並得到這個結果:'寫入/ home/lluisdev/www/webpage/resources/assets/js/lib/locales/vue -i18n-locales.generated.js' –

+0

我編輯問題,I獲得更具體的信息。 –

回答

1

嘗試像這樣以exec替換一口外殼:

var exec = require('child_process').exec; 

gulp.task('js-langs', function (cb) { 
    exec('php artisan vue-i18n:generate', function (err, stdout, stderr) { 
    console.log(stdout); 
    console.log(stderr); 
    cb(err); 
    }); 
}); 

,如果有版本的一些錯誤,你可以卸載VUE模板編譯和重新安裝:

npm uninstall vue-template-compiler 
npm install vue-template-compiler 

或者你可以做:

npm update vue 

或者您可以使用此命令的其他方式爲您提供確切的版本併爲您安裝它:

npm uninstall vue-template-compiler & npm install "[email protected]$(npm list --depth=0 | awk '/[email protected]/{print substr($2, 5)}')" 
+0

完美,感謝@Maraboc! –