cheshire137 / gulp-ruby-haml

Haml plugin for Gulp that uses the Ruby Haml gem.
https://www.npmjs.com/package/gulp-ruby-haml
MIT License
27 stars 13 forks source link

Error: Cannot find module 'gulp-ruby-haml' #20

Closed bencoullie closed 8 years ago

bencoullie commented 8 years ago

I have Ruby installed and have run gem install haml successfully.

My gulpfile.js looks like this:

var gulp = require('gulp');
var haml = require('gulp-ruby-haml');

// Compile Haml into HTML
gulp.task('haml', function() {
  gulp.src('./haml/*.haml', {read: false}).
       pipe(haml()).
       pipe(gulp.dest(''));
});

// The default task (runs all designated tasks on 'gulp')
gulp.task('default', ['haml']);

However, when I run gulp on the project I receive this error:

Error: Cannot find module 'gulp-ruby-haml'
    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> (/home/ben/projects/portfolio2/gulpfile.js:6:12)
    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 Module.require (module.js:364:17)

Sorry if this is not a general bug - I'm not sure. If I am missing anything please just nudge me in the right direction. FYI I'm not using rails on this project. It is a static project with haml compiled by gulp-ruby-haml and gulp.

mentorkadriu commented 8 years ago

Run npm install gulp-ruby-haml --save inside project dir

cheshire137 commented 8 years ago

@mentorkadriu is right. You want a line for gulp-ruby-haml in your package.json so that npm knows to install it when you do npm install. Doing npm install gulp-ruby-haml --save will 1) install gulp-ruby-haml and 2) add a line to your package.json saying gulp-ruby-haml is required.

bencoullie commented 8 years ago

Thanks so much guys - it's no longer throwing the missing module error and all's right with the world. I think I must have skipped over that part, sorry.