Search code examples
vue.jsgulp

Error about vue.js appears when try to make a gulp production


When I'm trying to make gulp --production I get this error:

[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

It seems that there are a problem with Vue anyone know how to fix it?

I'm trying to find information about the error if I found it I will post it here too.

The lines inside the gulpfile that makes the error are this:

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

If I try to make php artisan vue-i18n:generate in terminal I get this:

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

gulpfile

enter image description here


Solution

  • Try to replace gulp shell with exec like this :

    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);
      });
    });
    

    And if there is some errors of version you can uninstall vue-template-compiler and reinstall it :

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

    Or you can do just :

    npm update vue
    

    Or an other way you can use this command to get you the exact version and install it for you :

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