“MODULE_DOES_NOT_EXIST” when trying to utilize @NAmdConfig

My modules file is located at “SuiteScripts/Config/modules.json” and contains the following contents:

{
    "paths": {
        "prefUtils": "SuiteScripts/Modules/Pref.js"
    }
}

In a Suitelet file, the following is at the top:

/**
* @NApiVersion 2.1
* @NScriptType Suitelet
* @NAmdConfig /SuiteScripts/Config/modules.json
*/

define('prefUtils'], function (prefUtils) {

.....

However this script errors with the message:

{"type":"error.SuiteScriptModuleLoaderError","name":"MODULE_DOES_NOT_EXIST","message":"Module does not exist: /prefUtils.js","stack":[]}

It’s as if the module config file isn’t getting recognized.

 

Replacing


define('prefUtils'], function (prefUtils) {

with


define('SuiteScripts/Modules/Pref.js'], function (prefUtils) {

does not cause any error.

Beginner Asked on April 11, 2020 in SuiteScript.

Thanks for sharing this! We issued a fix, do let me know if this still persists.

on April 23, 2020.
Add Comment
1 Answer(s)

Use @NApiVersion 2.0

Intermediate Answered on April 11, 2020.

Thanks for the suggestion! Doing that resulted in the following error instead:

 {"type":"error.SuiteScriptModuleLoaderError","name":"UNEXPECTED_ERROR","message":"missing ; before statement (/SuiteScripts/Modules/Pref.js#8)","stack":[]} 

Which is because that (SS2.1) module and Suitelet contains let declarations. I changed them all to var and the error went away. Then I reverted the Suitelet back to @NApiVersion 2.1 and it continues to work fine. Very strange since the Suitelet, module, and module config files are all identical to before apart from let -> var.

Maybe just a bug with 2.1, I dunno…

on April 11, 2020.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.
  • This site made possible by our sponsors: Tipalti