laravelnpmgulpvagrantpuphpet

Gulp Invalid or unexpected token error on dateformat.js


I am getting the following error. I can't seem to know why.

I am in a vagrant vm (Ubuntu 16) and PHP 7.1

Trying to run Laravel 5.3.

[05:05 PM]-[vagrant@sworup]-[/var/www/sworup.dev]-[git master]
$ gulp
/var/www/sworup.dev/node_modules/dateformat/lib/dateformat.js:92


SyntaxError: Invalid or unexpected token
    at Object.exports.runInThisContext (vm.js:76:16)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/var/www/sworup.dev/node_modules/gulp-util/index.js:5:9)
    at Module._compile (module.js:570:32)

Solution

  • This issue seems to rooted to the fact that Vagrant does not allow symlink by default.

    There are packages in Laravel that just don't work well with Gulp. It breaks at NPM install and the effects are seen during Gulp command.

    Tried getting the packages manually, tried downgrading them but the issue is in dependencies of the packages so it didn't work.

    Ended up using Docker instead.