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

Error on javascript browser console. #3

Closed
am opened this issue Jul 5, 2013 · 7 comments
Closed

Error on javascript browser console. #3

am opened this issue Jul 5, 2013 · 7 comments

Comments

@am
Copy link
Contributor

am commented Jul 5, 2013

When I run the app I get a error on console, apparently related to require.

Uncaught Error: Mismatched anonymous define() module: function () { return io; } http://requirejs.org/docs/errors.html#mismatch require.js:8

After this the main.js code don't get ejecuted and the app is not initializated.

For all I can see at the moment seams related to this requirejs error.

am added a commit to am/emmet.docpad that referenced this issue Jul 5, 2013
sergeylukin added a commit that referenced this issue Jul 5, 2013
Fixes sergeylukin/emmet.docpad/#3
@am
Copy link
Contributor Author

am commented Jul 5, 2013

Sorry but it's not yet solved with the last commit. The issue remains and it happens randomly when refreshing the page. Give you 3 different outputs I get from console, running localhost:

  1. no error:

    Charts initialized! charts.js:3
    App is initialized 
    
  2. output 1:

    Charts initialized! charts.js:3
    Uncaught TypeError: Object #<Object> has no method 'init' 
    
  3. output 2:

    Uncaught Error: Mismatched anonymous define() module: function () { return io; }
    http://requirejs.org/docs/errors.html#mismatch require.js:8
    Charts initialized! 
    
  4. output 3:

    Charts initialized! charts.js:3
    Uncaught TypeError: Object #<Object> has no method 'init' 
    

Can this be related to the order the scripts are being loaded? I feel a bit lost in here, since this is the first time I work with grunt...

@sergeylukin
Copy link
Owner

We discussed this issue once in issue tracker of docpad livereload plugin, please find it and see if there is a working solution. I'll check this later as well.

Sent from my BlackBerry® smartphone from orange

-----Original Message-----
From: antonio miranda notifications@github.com
Date: Fri, 05 Jul 2013 02:46:33
To: sergeylukin/emmet.docpademmet.docpad@noreply.github.com
Reply-To: "sergeylukin/emmet.docpad" reply@reply.github.com
Cc: Sergey Lukincontact@sergeylukin.com
Subject: Re: [emmet.docpad] Error on javascript browser console. (#3)

Sorry but it's not yet solved with the last commit. The issue remains and it happens randomly, when refreshing the page. Give you 3 different outputs I get from console, running localhost:

  1. no error:

    Charts initialized! charts.js:3
    App is initialized 
    
  2. output 1:

    Charts initialized! charts.js:3
    Uncaught TypeError: Object #<Object> has no method 'init' 
    
  3. output 2:

    Uncaught Error: Mismatched anonymous define() module: function () { return io; }
    http://requirejs.org/docs/errors.html#mismatch require.js:8
    Charts initialized! 
    
  4. output 3:

    Charts initialized! charts.js:3
    Uncaught TypeError: Object #<Object> has no method 'init' 
    

Can this be related to the order the scripts are being loaded? I feel a bit lost in here, since this is the first time I work with grunt...


Reply to this email directly or view it on GitHub:
#3 (comment)

am added a commit to am/emmet.docpad that referenced this issue Jul 5, 2013
@am
Copy link
Contributor Author

am commented Jul 5, 2013

Hi @sergeylukin I was looking into that as well =) I think it works just to load the socket.io into the template. I've added the script tag inside a build block, this way it is override when compiling the production. I'll make a new pull request, take a look into that, as I'm not sure if it breaks anything. At least the error in console is gone ;)

Thank you.

@sergeylukin
Copy link
Owner

Production doesn't need it and it doesn't get there which is OK. However in development environment, just loading socket.io before requirejs only works in most cases but not always.. Also, you don't have to explicitly insert script tag, it's enough to just move != getBlock('scripts').toHTML() block around.
I'm working on implementing solution proposed by @digitaldesigndj in docpad/docpad-plugin-livereload#5

Btw @balupton is working on replacing socket.io solution docpad/docpad-plugin-livereload#6 so I don't think we should waste too much time on this issue for now

@sergeylukin
Copy link
Owner

On my end works great so far, thanks @digitaldesigndj !!
Please reopen if problem not solved on your end.

@sergeylukin
Copy link
Owner

Oh, and yes, if you're testing on existing project, please run following after merging in commit 73d04c4

npm install docpad-plugin-livereload --force

@sergeylukin
Copy link
Owner

Patched live-reload module name resolution. Should be good now.

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