The error could be caused by many problems and I think I just found a niche one.
Scope
The finding is just for non-AMD situations, where @NAmdConfig is not used and only the routes to the library files are referenced in the define([])
#1 Did you miss .js in the file name?
Credit to this stackoverflow topic https://stackoverflow.com/questions/42961018/module-does-not-exist-suitescript
If you missed the file extension then this error may occur and the fix is appending .js after your file name.
#2 Did you add a space in the file name, before the extension?
If you put a space before the extension and named your js file like some .js
then this error happens!
I can see NetSuite trims the file name without the extension then executes, results in show the error message, ignoring the actual file name.
{"type":"error.SuiteScriptModuleLoaderError","name":"MODULE_DOES_NOT_EXIST","message":"模块不存在:/SuiteScripts/some.js","stack":[]}
This can be fixed via removing the space before the extension.
这个错误原因很多,但是我发现了一个很微小的情况。
讨论范畴
仅讨论非AMD模块化的组件,这种情况下我们不用@NAmdConfig,只是在 define([]) 中引用脚本文件的路径。
#1 是不是丢了脚本文件扩展名.js?
这个stackoverflow说的就是这个情况 https://stackoverflow.com/questions/42961018/module-does-not-exist-suitescript
如果你丢了扩展名就有这个问题,补好就没事儿了。
#2 是不是在扩展名前加了个空格
如果你在文件名之后,扩展名之前放一个空格,像是some .js
就报这个错了。
NetSuite是先把文件名trim之后再运行的,这种情况下他会找不到真正的那个文件,然后报下面这个错误
{"type":"error.SuiteScriptModuleLoaderError","name":"MODULE_DOES_NOT_EXIST","message":"模块不存在:/SuiteScripts/some.js","stack":[]}
这个错误修复就是把空格移除掉。
Comments