Granite clientlibs are included two times | Community
Skip to main content
June 7, 2018
Solved

Granite clientlibs are included two times

  • June 7, 2018
  • 3 replies
  • 1727 views

I'm getting the following error on the page, when I access that in AEM 6.3 touch UI.

foundation.1.0.js:7460 Uncaught TypeError: now.utcOffset is not a function

    at HTMLDocument.<anonymous> (foundation.1.0.js:7460)

    at HTMLDocument.dispatch (jquery.1.0.js:4665)

    at HTMLDocument.elemData.handle (jquery.1.0.js:4333)

    at Object.trigger (jquery.1.0.js:4574)

    at HTMLDocument.<anonymous> (jquery.1.0.js:5284)

    at Function.each (jquery.1.0.js:384)

    at jQuery.fn.init.each (jquery.1.0.js:136)

    at jQuery.fn.init.trigger (jquery.1.0.js:5283)

    at HTMLDocument.<anonymous> (foundation.1.0.js:7505)

    at HTMLDocument.dispatch (jquery.1.0.js:4665)

I checked the source code of the page and found that few of js files are included two times. One is from /libs (/etc.clientlibs/clientlibs) and another is from /etc. I think that the above error must be coming because of any conflict happening due to multiple occurrence of files on the same page. It's occurring on all the pages. Even if I access any Admin page in touch UI like /asset.html/content/dam.

<script type="text/javascript" src="/etc.clientlibs/clientlibs/granite/jquery.1.0.js"></script>

<script type="text/javascript" src="/etc/clientlibs/granite/jquery.1.0.js"></script>

<script type="text/javascript" src="/etc.clientlibs/clientlibs/granite/utils.1.0.js"></script>

<script type="text/javascript" src="/etc/clientlibs/granite/utils.1.0.js"></script>

<script type="text/javascript" src="/etc.clientlibs/clientlibs/granite/jquery/granite.1.0.js"></script>

<script type="text/javascript" src="/etc/clientlibs/granite/jquery/granite.1.0.js"></script>

<script type="text/javascript" src="/etc.clientlibs/clientlibs/granite/coralui2keys.1.0.js"></script>

<script type="text/javascript" src="/etc.clientlibs/clientlibs/granite/typekit.1.0.js"></script>

<script type="text/javascript" src="/etc/clientlibs/granite/typekit.1.0.js"></script>

<script type="text/javascript" src="/etc.clientlibs/clientlibs/granite/moment.1.0.js"></script>

<script type="text/javascript" src="/etc/clientlibs/granite/moment.1.0.js"></script>

<script type="text/javascript" src="/etc.clientlibs/clientlibs/granite/coralui2.1.0.js"></script>

<script type="text/javascript" src="/etc.clientlibs/clientlibs/granite/uritemplate.1.0.js"></script>

<script type="text/javascript" src="/etc/clientlibs/granite/uritemplate.1.0.js"></script>

<script type="text/javascript" src="/etc.clientlibs/clientlibs/granite/history.1.0.js"></script>

<script type="text/javascript" src="/etc/clientlibs/granite/history.1.0.js"></script>

<script type="text/javascript" src="/etc.clientlibs/granite/ui/components/coral/foundation/clientlibs/foundation.1.0.js"></script>

<script type="text/javascript" src="/etc.clientlibs/clientlibs/granite/jquery/animation.1.0.js"></script>

<script type="text/javascript" src="/etc/clientlibs/granite/jquery/animation.1.0.js"></script>

<script type="text/javascript" src="/etc.clientlibs/granite/ui/clientlibs/quickactions.1.0.js"></script>

<script type="text/javascript" src="/etc.clientlibs/granite/ui/components/endor/clientlibs.1.0.js"></script>

<script type="text/javascript" src="/etc.clientlibs/granite/ui/components/foundation/clientlibs/foundation.1.0.js"></script>

<script type="text/javascript" src="/etc.clientlibs/clientlibs/granite/lodash/modern.1.0.js"></script>

<script type="text/javascript" src="/etc/clientlibs/granite/lodash/modern.1.0.js"></script>

<script type="text/javascript" src="/apps/acs-commons/touchui-widgets/composite-multifield.js"></script>

<script type="text/javascript" src="/apps/acs-commons/authoring/vendor/jquery.fonticonpicker.js"></script>

<script type="text/javascript" src="/apps/acs-commons/touchui-widgets.js"></script>

Is there any way/configuration to avoid to stop multiple occurrences of the these granite clientlibs.  I am working on AEM 6.3.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Ashwani_Sahni

Thanks Kautuk for you reply.

Actually, the error was coming because of older version of moment.js which was putting in /etc/clientlibs location. This file was overriding the latest version of the same file which was lying in /libs directory.  After removing it from /etc, error has gone.

Thanks,

AS

3 replies

kautuk_sahni
Community Manager
Community Manager
June 7, 2018

Hi,

I guess you have clientlibs present under both /apps and /etc folder and for /apps you have allowProxy property = true (This makes the clientlibs avail­able via the url /etc.clientlibs/).

So, try to remove the clientlibs from the etc folder and keep it under /apps folder (recommended).

In order to better isolate code from content and configuration, it is recommended to locate client libraries under /apps and expose them via /etc.clientlibs by leveraging the allowProxy property.

Note:- When using proxied client libraries, the AEM Dispatcher configuration may require an update to ensure the URIs with the extension clientlibs are allowed.

Kautuk Sahni
Ashwani_SahniAuthorAccepted solution
June 10, 2018

Thanks Kautuk for you reply.

Actually, the error was coming because of older version of moment.js which was putting in /etc/clientlibs location. This file was overriding the latest version of the same file which was lying in /libs directory.  After removing it from /etc, error has gone.

Thanks,

AS

July 9, 2018

What is the dispatcher config change that we need to do. Allowing /etc.clientlibs/* in .any file?