techn0guy's avatar

Gulp failing when using version()

Hello,

I was looking to implement versioning within my app. However, if I append .version() and run gulp an error is thrown:

 if (path.indexOf('./') == 0) {
                        ^

TypeError: Cannot read property 'indexOf' of undefined

Additionally, when I try the line:


    if (mix.inProduction()) {
        mix.version();
    }

An error is thrown that the function does not exist

if (mix.inProduction()) {
            ^

TypeError: mix.inProduction is not a function

And here is my package.json file:

{
  "private": true,
  "scripts": {
    "prod": "gulp --production",
    "dev": "gulp watch"
  },
  "devDependencies": {
    "bootstrap-sass": "^3.3.7",
    "gulp": "^3.9.1",
    "jquery": "^3.3.1",
    "laravel-elixir": "^6.0.0-18",
    "laravel-elixir-vue": "^0.1.4",
    "laravel-elixir-vue-2": "^0.3.0",
    "laravel-elixir-webpack-official": "^1.0.2",
    "laravel-mix": "^2.0",
    "lodash": "^4.17.10",
    "vue": "^2.5.16",
    "vue-resource": "^1.5.1"
  },
  "dependencies": {
    "@fortawesome/fontawesome": "^1.1.8",
    "@fortawesome/fontawesome-free-brands": "^5.0.13",
    "@fortawesome/fontawesome-pro-light": "^5.0.13",
    "@fortawesome/fontawesome-pro-regular": "^5.0.13",
    "@fortawesome/fontawesome-pro-solid": "^5.0.13",
    "gulp.spritesmith": "^6.9.0",
    "inputmask": "^4.0.0",
    "overhang": "^1.0.5",
    "sweetalert": "^2.1.0",
    "trip.js": "^3.3.3",
    "v-tooltip": "^2.0.0-rc.33",
    "vee-validate": "^2.0.9",
    "vue-cookie": "^1.1.4",
    "vue-inputmask": "^0.1.2"
  }
}
0 likes
1 reply
Cronix's avatar

You're mixing 2 very different tools. Laravel Elixir (now deprecated, which used gulp) and Laravel Mix (the replacement using webpack). Elixir hasn't been used by laravel since v5.2, almost 2 years ago. You need to use one, or the other. You can't use both.

If you want to use versioning with Elixir, you need to do it the Elixir way. See the docs for Elixir: https://laravel.com/docs/5.2/elixir

You'd need to get rid of laravel mix though, since they both use "mix".

Please or to participate in this conversation.