bertug.personal@gmail.com's avatar

gulp watch automatically tries production and throws an error

I have a project that I got from my friends, and I setup the environment.

Now when I try gulp it works and compiles perfectly. However, if I try to gulp watch it throws error:

internal/streams/legacy.js:59
      throw er; // Unhandled stream error in pipe.
      ^

Error: ENOENT: no such file or directory, stat '/home/vagrant/Code/proj/public/build/js/all-86db1d88de.js'

As far as I understand, it is trying to force production or minifying, whereas running gulp doesn't so it works.

What am I doing wrong with the gulp watch?

Everyone else except me can use gulp watch. Our gulp versions are same - 3.9.1, but node versions are different, their one is 6.5.0, my one is 7.10.1

0 likes
3 replies
Dunsti's avatar

have a look in your package.json (in project-root)

there you can find the definitions of gulp-commands under "scripts": { ... }

maybe you can see something there (maybe the flag --production with the watch-command, or something like this)

bertug.personal@gmail.com's avatar

@Dunsti My package.json scrips looks like this:

"scripts": {
    "dev": "node node_modules/cross-env/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "watch": "node node_modules/cross-env/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "watch-poll": "node node_modules/cross-env/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --watch-poll --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "hot": "node node_modules/cross-env/bin/cross-env.js NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
    "production": "node node_modules/cross-env/bin/cross-env.js NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
  },

Do you think any of these causing it? I don't see any --production in watch command. Also, is this the one I run when I run gulp watch?

Dunsti's avatar

yes, these are the commands - but they change depending on what you use.

I'm not too good in gulp and stuff, but my package.json looks like this: (I guess, we haven't changed this recently - should be still from Laravel 5.2 ;-) )

  "scripts": {
    "prod": "gulp --production",
    "dev": "gulp watch",
    "start": "gulp --gulpfile gulpfile.babel.js watch"
  },

But you said that it works on others systems with the same project? Did you call npm install after cloning the repository?

You could also check and compare your .env-files (or maybe other non-versioned files)

Other than that I can just guess. Maybe someone with more insight to npm and gulp can help?

Please or to participate in this conversation.