Error during importing user script!


I want to import moment js library:

function initMomentLibrary(){
    try {
      print ("start init moment\n");
      eval( include( 'moment-with-locales.js' ) );
      print( 'Success: ' + moment() );
    } catch ( _ex ) { 
      print( 'Error: ' + _ex.message );

but after invoking this function I’m getting error:

[2015-07-29 07:08:35][app][INFO     ] Script User Script "sync" output:
start init moment
Error: Duplicate data property in object literal not allowed in strict mode

Any help?


This error appears to be due to duplicate assignments to the same value, either in the included js file or in the scripting environment in general. We have used include() without issue for other libraries. See this thread and this page from the docs.

A Google search provided several possibilities for this error.