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

Unhandled rejection TypeError #12

Closed
surpmillet opened this issue Feb 11, 2015 · 11 comments
Closed

Unhandled rejection TypeError #12

surpmillet opened this issue Feb 11, 2015 · 11 comments
Assignees

Comments

@surpmillet
Copy link

[22:51:04] [-log:] em-cli is doing REALLY hard to initialize your repo ...
Unhandled rejection TypeError: undefined is not a function
at C:\Users\she\AppData\Roaming\npm\node_modules\ember-rocks\src\commands\create.js:166:7
at tryCatcher (C:\Users\she\AppData\Roaming\npm\node_modules\ember-rocks\node_modules\bluebird\js\main\util.js:2
4:31)
at Promise._settlePromiseFromHandler (C:\Users\she\AppData\Roaming\npm\node_modules\ember-rocks\node_modules\blu
ebird\js\main\promise.js:466:31)
at Promise._settlePromiseAt (C:\Users\she\AppData\Roaming\npm\node_modules\ember-rocks\node_modules\bluebird\js
main\promise.js:545:18)
at Promise._settlePromises (C:\Users\she\AppData\Roaming\npm\node_modules\ember-rocks\node_modules\bluebird\js\m
ain\promise.js:661:14)
at Async._drainQueue (C:\Users\she\AppData\Roaming\npm\node_modules\ember-rocks\node_modules\bluebird\js\main\as
ync.js:79:16)
at Async._drainQueues (C:\Users\she\AppData\Roaming\npm\node_modules\ember-rocks\node_modules\bluebird\js\main\a
sync.js:89:10)
at Async.drainQueues (C:\Users\she\AppData\Roaming\npm\node_modules\ember-rocks\node_modules\bluebird\js\main\as
ync.js:14:14)
at process._tickCallback (node.js:419:13)

@mattma
Copy link
Owner

mattma commented Feb 11, 2015

I will look into it. Thanks

@mattma
Copy link
Owner

mattma commented Feb 11, 2015

Indeed! it is a problem. I will roll in a fix soon.

@mattma mattma self-assigned this Feb 11, 2015
@surpmillet
Copy link
Author

@mattma thanks,and how can I compile my handlebars templates and concat into a templates.js without wrapping amd by using gulp-htmlbars?

@mattma
Copy link
Owner

mattma commented Feb 12, 2015

In your generated ember-rocks project root folder, open gulpfile.js

Search for task buildhbs

gulp.task('buildhbs', function () {
  return gulp.src(clientFolder + '/app/templates/**/*.hbs')
    .pipe($.htmlbars({
      isHTMLBars:       true,
      templateCompiler: require('./client/assets/vendors/ember/ember-template-compiler')
    }))
    .pipe($.wrapAmd({
      deps:         ['exports'],          // dependency array
      params:       ['__exports__'],        // params for callback
      moduleRoot:   'client/app/',
      modulePrefix: 'rocks/'
    }))
    .pipe($.replace(
      /return export default/, 'return __exports__["default"] ='
    ))
    .pipe($.concat('templates.js'))
    .pipe(gulp.dest(clientFolder + '/assets/build/'));
});

So in here gulp-wrap-amd module is actually wrapped output code into the amd format. Feel free to replace or remove to whatever you like.

@surpmillet
Copy link
Author

@mattma thanks.
In the past,I compiled by using gulp-ember-template-compiler and it works well with ember<1.9and handlebars<2.0.Now,I compile by using gulp-htmlbars,but it doesn't work with ember#1.11.0.why?

//templates.js by using gulp-ember-template-compiler
Ember.TEMPLATES['application'] = Ember.Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
  var stack1, buffer = '';//...
Ember.TEMPLATES['main'] = Ember.Handlebars.template//...
Ember.TEMPLATES['main/index'] = Ember.Handlebars.template//...
//templates.js by using gulp-htmlbars
define("application",["exports"],function(__exports__){
return __exports__["default"] = Ember.HTMLBars.template((function() {
  return {
    isHTMLBars: true,
    blockParams: 0,
    cachedFragment: null,
    hasRendered: false,//...
define("main",["exports"],function(__exports__)//...
define("main/index",["exports"],function(__exports__)//...

@mattma
Copy link
Owner

mattma commented Feb 13, 2015

Have you read this post? I think it should answer your question.

If you look at the code that you have attached in your questions, you should see the output of Ember.Handlebars.template, now with Ember@1.10.0, you could drop the handlebars.js, and use htmlbars via the new syntax Ember.HTMLBars.template

I have been busy but I will take care of this issue soon.

@surpmillet
Copy link
Author

@mattma thanks.I have resolved the problem.and published a plugin named gulp-ember-template which could compile the handlebars for ember.js>1.11.0.

@mattma
Copy link
Owner

mattma commented Feb 14, 2015

@surpmillet Finally get some time today to resolve this issue. Going to submit the patch soon.

I did not go in-depth on your plugin. First, it is a great initiative to issue a new plugin. Here is a few things that you need to consider,

  1. gulp eco system, one plugin does one thing, does really good. Not used to solve your own particular problem.
  2. gulp eco system, if someone else already have a solution to solve something, use that one.

gulp-htmlbars is what I wrote which used in ember-rocks has 100% code coverage and full unit tests. Currently, by default it works for handlebars file out of box. I am sure that we could tweak it to suite your specific use case without authoring another plugin.

mattma added a commit that referenced this issue Feb 14, 2015
@mattma
Copy link
Owner

mattma commented Feb 14, 2015

@surpmillet Could you take the latest 0.9.3 version of Ember Rocks, verify the bug has been fixed? If it does, close it.

Thanks.

@mattma
Copy link
Owner

mattma commented Feb 17, 2015

@surpmillet Just gonna close it since I had not heard anything from you. Well, if it is still an issue, please, reopen it. Thanks.

@mattma mattma closed this as completed Feb 17, 2015
@surpmillet
Copy link
Author

@mattma OK,thanks for your help

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

No branches or pull requests

2 participants