mjmlio / gulp-mjml

Add Gulp to your MJML workflow!
MIT License
162 stars 37 forks source link

TypeError: undefined is not a function #5

Closed jitendravyas closed 7 years ago

jitendravyas commented 8 years ago

Getting this error

18:39:34] Using gulpfile ~/my-projects/mjmlgulp/gulpfile.js
[18:39:34] Starting 'default'...
[18:39:34] Finished 'default' after 8.8 ms
/Users/jitendravyas/my-projects/mjmlgulp/node_modules/gulp-mjml/node_modules/mjml/node_modules/mjml-core/lib/decorators/MJMLElement.js:162
          var childProps = Object.assign({}, child.props);
                                  ^
TypeError: undefined is not a function
    at /Users/jitendravyas/my-projects/mjmlgulp/node_modules/gulp-mjml/node_modules/mjml/node_modules/mjml-core/lib/decorators/MJMLElement.js:162:35
    at Array.forEach (native)
    at MJMLElement._this.renderWrappedOutlookChildren (/Users/jitendravyas/my-projects/mjmlgulp/node_modules/gulp-mjml/node_modules/mjml/node_modules/mjml-core/lib/decorators/MJMLElement.js:161:18)
    at Container.render (/Users/jitendravyas/my-projects/mjmlgulp/node_modules/gulp-mjml/node_modules/mjml/node_modules/mjml-container/lib/index.js:114:9)
    at ReactCompositeComponentMixin._renderValidatedComponentWithoutOwnerOrContext (/Users/jitendravyas/my-projects/mjmlgulp/node_modules/gulp-mjml/node_modules/mjml/node_modules/mjml-core/node_modules/react/lib/ReactCompositeComponent.js:687:34)
    at ReactCompositeComponentMixin._renderValidatedComponent (/Users/jitendravyas/my-projects/mjmlgulp/node_modules/gulp-mjml/node_modules/mjml/node_modules/mjml-core/node_modules/react/lib/ReactCompositeComponent.js:707:32)
    at wrapper [as _renderValidatedComponent] (/Users/jitendravyas/my-projects/mjmlgulp/node_modules/gulp-mjml/node_modules/mjml/node_modules/mjml-core/node_modules/react/lib/ReactPerf.js:66:21)
    at ReactCompositeComponentMixin.performInitialMount (/Users/jitendravyas/my-projects/mjmlgulp/node_modules/gulp-mjml/node_modules/mjml/node_modules/mjml-core/node_modules/react/lib/ReactCompositeComponent.js:291:30)
    at ReactCompositeComponentMixin.mountComponent (/Users/jitendravyas/my-projects/mjmlgulp/node_modules/gulp-mjml/node_modules/mjml/node_modules/mjml-core/node_modules/react/lib/ReactCompositeComponent.js:222:21)
    at wrapper [as mountComponent] (/Users/jitendravyas/my-projects/mjmlgulp/node_modules/gulp-mjml/node_modules/mjml/node_modules/mjml-core/node_modules/react/lib/ReactPerf.js:66:21)

Gulpfile

var gulp = require('gulp');
var mjml = require('gulp-mjml')

gulp.task('default', function () {
  gulp.src('./index.mjml')
    .pipe(mjml())
    .pipe(gulp.dest('./html'))
});

index.mjml

<mjml>
  <mj-body>
    <mj-container>
      <mj-section>
        <mj-column>

          <mj-text font-size="20px" color="#F45E43" font-family="helvetica" align="center">Hello World</mj-text>
          <mj-divider border-color="#F45E43"></mj-divider>
          <mj-text font-size="16px" color="blue" font-family="helvetica">More text</mj-text>

        </mj-column>
      </mj-section>
    </mj-container>
  </mj-body>
</mjml>
WeshGuillaume commented 8 years ago

What version of node are you using ?

hadifarnoud commented 8 years ago

same issue here v0.12.7

SilentF commented 8 years ago

I have similar error here var childProps = Object.assign({}, child.props); ^ TypeError: Object function Object() { [native code] } has no method 'assign'

node version : v4.4.7 npm version : 3.10.5

I installed gulp-mjml via npm and got this error when starting my task

var mjml = require('gulp-mjml')

gulp.task('mjml', function () { return gulp.src('./Emails/mjml/welcome2.mjml') .pipe(mjml()) .pipe(gulp.dest('./Emails')) })

meriadec commented 7 years ago

Object.assign is part of ES2015 and has been implemented in Node.js since v4.4.6 (see here: http://node.green/#Object-static-methods).

You can use babel-polyfill to use that functionality in older node versions.

npm install --save babel-polyfill

Then in your source code:

require('babel-polyfill')