Is your rule code in the UI or a .js file?
If a file, is this the full contents of the .js file?
Do you have any other libraries installed which work or do all libraries give the same error. you can install openhab_rules_tools and require it just as a test if not. See openHAB Rules Tools Announcements for details on what this library does if you are curious. But installing it and importing it doesn’t really require extra details.