Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't seem to work in OSX #35

Closed
cksachdev opened this issue Jul 9, 2015 · 4 comments
Closed

Doesn't seem to work in OSX #35

cksachdev opened this issue Jul 9, 2015 · 4 comments
Labels

Comments

@cksachdev
Copy link

My Gulp file

'use strict';

var gulp = require('gulp');

require('require-dir')('./gulp');

gulp.task('default', ['clean'], function () {
    gulp.start('build');
});

I can see the package is loaded.

reloading plugin FixMacPath.FixPath
reloading plugin Gulp.base_command
reloading plugin Gulp.cross_platform_codecs
reloading plugin Gulp.gulp
reloading plugin Gulp.progress_notifier

But when I try to run Gulp, I still get the errors

Running 'build'...

module.js:340
    throw err;
          ^
Error: Cannot find module 'gulp-util'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/usr/local/bin/gulp:4:13)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)

Is there any way to check and run the commands directly in sublime, to make sure that it has detected the right versions and environment variables needed to run Gulp? I have installed SublimeFixMacPath.

@nicosantangelo
Copy link
Owner

I think that this has to do with require-dir, I never really tried it and I'm not sure it works correctly.

There's really no way to check if the gulp version you're running from sublime is correct ( I think I'll add something like that later ), but you can force your env vars with exec_args.

I have little time on my hands lately but I'm intending to support require-dir ( #34 ). I need to have a local project to test the package on first.

If you don't mind, how is your gulp project setup?, do you have a gulp folder with every task in it?

@cksachdev
Copy link
Author

Yes, there is a gulp directory with all the tasks inside it. Refer to screenshot below:
Screenshot

@nicosantangelo
Copy link
Owner

Hello again!

I'm working on a new command to run an arbitrary commands with gulp, which will allow running -v if necessary. But in the meantime, if you're running Sublime-gulp 4.5.4 you can define a specific keybinding to:

{ "keys": ["KEYS"], "command": "gulp", "args": { "task_name": "", "task_flag": "-v" } }

Still, I can't seem to recreate the error, my local setup:

gulpfile.js

'use strict';

var gulp = require('gulp');

require('require-dir')('./gulp');

gulp.task('default', ['clean'], function() {
  gulp.start('clean');
});

./gulp/clean.js

var gulp = require('gulp'),
    rimraf = require('rimraf');


gulp.task('clean', function() {
  rimraf.sync('www/dist/main.js');
  rimraf.sync('www/dist/main.min.js');
});

Preferences -> Package Settings -> Gulp -> Settings - User (this might not be necessary or different for your environment)

{
    "exec_args": {
        "path": "/bin:/usr/bin:/usr/local/bin"
    }
}

After picking Gulp on Sublime, I can see clean and default. After picking `clean:

Running 'clean'...
[12:53:39] Using gulpfile ~/path/gulpfile.js
[12:53:39] Starting 'clean'...
[12:53:39] Finished 'clean' after 966 μs

So! Things you could try:

  1. Try adding exec_args to your settings
  2. Disable SublimeFixMacPath and re-try with and without exec_args

If that does not work, please let me know what is inside your build.js task and your gulp version.

Let me know and thanks!

nicosantangelo added a commit that referenced this issue Aug 11, 2015
…ive does not work.

This allows using require-dir and fixes any future compatibility problem.
It only works if the `gulp` CLI version is 3.7.0 or higher. #34 #35 #40 #43
@nicosantangelo
Copy link
Owner

This should be working as of Version 5 (v5.0.0).
If you have any issues, please let me know ( @ mention me and I'll reopen this issue ).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants