Got "Uncaught TypeError: _.merge is not a function" Error

476 views
Skip to first unread message

gentleh

unread,
May 16, 2016, 5:27:31 AM5/16/16
to JointJS
I use Yii PHP framework and I add the following code to my views/page.php

<?php
    $baseUrl = Yii::app()->baseUrl;
    $cs = Yii::app()->getClientScript();
    $cs->registerCssFile($baseUrl.'/css/joint.css');
    $cs->registerScriptFile($baseUrl.'/js/jquery.min.js');
    $cs->registerScriptFile($baseUrl.'/js/lodash.js');
    $cs->registerScriptFile($baseUrl.'/js/underscore.js');
    $cs->registerScriptFile($baseUrl.'/js/backbone.js');
    $cs->registerScriptFile($baseUrl.'/js/joint.js');
?>

however, it didn't works.
The blowser console shows:

joint.js:4453 Uncaught TypeError: _.merge is not a function
index.php:131 Uncaught ReferenceError: joint is not defined

Also, I found that all of the above JS files have been refered except 'joint.js'.
Can somebody help me? thx.

Roman Bruckner

unread,
May 16, 2016, 5:30:40 AM5/16/16
to joi...@googlegroups.com
Hi,
do not register `underscore` at all and make sure the version of `lodash` is 3.10.1.
Best,
Roman

--

---
You received this message because you are subscribed to the Google Groups "JointJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jointjs+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

黄佳祥

unread,
May 16, 2016, 5:45:57 AM5/16/16
to joi...@googlegroups.com
It works! Thanks a lot. 
But it seems like that the sequence of registeration of JS files have an impact on it.
I firstly registed 'backbone.js', and it can not be refered, so I looked up the dependency of 'backbone.js',  and that's the reason why I add 'underscore.js'...
Anyway, the problem have been solved, thx.

--

---
You received this message because you are subscribed to a topic in the Google Groups "JointJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jointjs/ijqEv4vAJ2c/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jointjs+u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages