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

Mojs and require console error #29

Closed
wanbinkimoon opened this issue Mar 3, 2016 · 10 comments
Closed

Mojs and require console error #29

wanbinkimoon opened this issue Mar 3, 2016 · 10 comments

Comments

@wanbinkimoon
Copy link

I'have tried to install mojs using bower install mojs and the console keep reporting 2 undefined functions: require and mojs. I tried to fix it installing via bower requirejs but the problem kept going on. Am I skipping any passage?

@legomushroom
Copy link
Member

Hi @wanbinkimoon !

Thanks for the alert. Could you please post the entire log here, just tried to install it with bower install mojs and it worked fine.

Thanks!

@wanbinkimoon
Copy link
Author

This is what the console respond with this error

Console 
mojs.js:5 Uncaught ReferenceError: require is not defined
main.js:3 Uncaught ReferenceError: mojs is not defined

you can find the whole test project in this repo https://github.com/wanbinkimoon/mojs-test.git

@legomushroom
Copy link
Member

@wanbinkimoon pushed the fix to the master.

Meanwhile Bower updating package's version, please try to install mojs with bower install https://github.com/legomushroom/mojs.git#master

If it will ask a specific commit to use - that would be 3dfdc4ae03.

@wanbinkimoon
Copy link
Author

@legomushroom the problem is still there

EDIT
now the error are still 2 but different here a screenshot

@legomushroom
Copy link
Member

@wanbinkimoon please change the link
<script src="assets/vendors/mojs/lib/mojs.js" charset="utf-8"></script>
to
<script src="assets/vendors/mojs/build/mo.min.js" charset="utf-8"></script>

@wanbinkimoon
Copy link
Author

I did that you can see it in the new commit

@legomushroom
Copy link
Member

what do you pass as `parent' option?

@legomushroom
Copy link
Member

sorry, wrong direction.

I got the issue now, please move your scripts inside body tag (better to the very bottom of it). mojs adds modules to the document.body which is not yet inited if you will link it in the head thus you got the error. You will have the same issue with #mo-shape tag since you are trying to use it before it was declared.

Hope it helps.

@wanbinkimoon
Copy link
Author

It helped, error fixed. Thanks

@legomushroom
Copy link
Member

Welcome and thanks for the alert!

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