Hi, I was having the same trouble, you need to define require first (as the scriptablify at scriptable)
// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: gray; icon-glyph: magic;
// Defining function require
const require = importModule('scriptablify') // replace scriptablify with the name of the scriptable script
// Defaults to the latest version and no automatic update; if the file exists, just use it
const moment = await require('moment');
console.log(moment());