Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

namht1st's avatar

Cannot find module 'gulp-uglify'

I do tutorial on this video: https://laracasts.com/series/laravel-5-fundamentals/episodes/24?autoplay=true but when i use elixir to merge all css and js files (include 'jquery.js' and 'select2.min.js') it showed like this: C:\wamp\www\laravel5>gulp [11:25:35] Using gulpfile C:\wamp\www\laravel5\gulpfile.js [11:25:35] Starting 'default'... [11:25:35] Starting 'sass'...

Fetching Sass Source Files...

  • resources\assets\sass\app.scss

Saving To...

  • public\css\app.css

[11:25:36] Finished 'default' after 1.64 s [11:25:37] gulp-notify: [Laravel Elixir] Sass Compiled! [11:25:37] Finished 'sass' after 2.08 s [11:25:37] Starting 'styles'...

Fetching Styles Source Files...

  • resources\assets\css\libs\bootstrap.min.css
  • resources\assets\css\libs\select2.min.css

Saving To...

  • public\css\all.css

[11:25:37] gulp-notify: [Laravel Elixir] Stylesheets Merged! [11:25:37] Finished 'styles' after 432 ms [11:25:37] Starting 'scripts'...

Fetching Scripts Source Files...

  • resources\assets\js\libs\jquery.js
  • resources\assets\js\libs\select2.min.js

Saving To...

  • public\js\all.js

[11:25:38] 'scripts' errored after 822 ms [11:25:38] Error: Cannot find module 'gulp-uglify' from 'C:\wamp\www\laravel5\node_modules\laravel-elixir' at Function.module.exports [as sync] (C:\wamp\www\laravel5\node_modules\laravel-elixir\node_modules\gulp-load-plugins\node_modules\resolve\lib\sync.js:33:11) at requireFn (C:\wamp\www\laravel5\node_modules\laravel-elixir\node_modules\gulp-load-plugins\index.js:46:25) at Object.defineProperty.get (C:\wamp\www\laravel5\node_modules\laravel-elixir\node_modules\gulp-load-plugins\index.js:84:18) at gulpTask (C:\wamp\www\laravel5\node_modules\laravel-elixir\tasks\scripts.js:69:40) at null.definition (C:\wamp\www\laravel5\node_modules\laravel-elixir\tasks\scripts.js:22:25) at Task.run (C:\wamp\www\laravel5\node_modules\laravel-elixir\Task.js:94:17) at Gulp. (C:\wamp\www\laravel5\node_modules\laravel-elixir\index.js:89:52) at module.exports (C:\wamp\www\laravel5\node_modules\gulp\node_modules\orchestrator\lib\runTask.js:34:7) at Gulp.Orchestrator._runTask (C:\wamp\www\laravel5\node_modules\gulp\node_modules\orchestrator\index.js:273:3) at Gulp.Orchestrator._runStep (C:\wamp\www\laravel5\node_modules\gulp\node_modules\orchestrator\index.js:214:10) [11:25:38] Error in plugin 'run-sequence' Message: An error occured in task 'scripts'.

Can someone help me to fix this problem please. Thanks in advance P/s: Sorry for bad english ^^

0 likes
4 replies
ejdelmonico's avatar

post your gulpfile. did you run gulp --production by any chance?

1 like
namht1st's avatar

@ejdelmonico thanks for reply. I've run gulp --production already but it still had same error. Here is my gulpfile.js :

var elixir = require('laravel-elixir');

elixir(function (mix) { mix.sass('app.scss');

mix.styles([
    'libs/bootstrap.min.css',
    'libs/select2.min.css'
]);

mix.scripts([
    'libs/jquery.js',
    'libs/select2.min.js'
]);

});

ejdelmonico's avatar
Level 53

Sometimes, when I have strange happenings I just delete my node_modules folder and run npm install again. During that reinstall, I make sure there are no errors like...say an error with gulp-uglify. Try that.

Please or to participate in this conversation.