[SOLUTION] fix Script Error: internal/modules/cjs/loader.js:323

2,020 views
Skip to first unread message

wheelie tips

unread,
Feb 4, 2022, 5:04:37 AM2/4/22
to DroidScript
I have struggled with this error for a few hours:

• _READY_
• Script Error: internal/modules/cjs/loader.js:323
• throw err;
• ^
• Error: Cannot find
module '/storage/emulated/0/Android/data/com.smartphoneremote.androidscriptfr...
• at tryPackage ( internal/modules/cjs/loader.js:315:19)
• at Function.Module._findPath ( internal/modules/cjs/loader.js:528:18)
• at Function.Module._resolveFilename ( internal/modules/cjs/loader.js:818:27)
• at Function.Module._load ( internal/modules/cjs/loader.js:687:27)
• at Module.require ( internal/modules/cjs/loader.js:903:19)
• at require ( internal/modules/cjs/helpers.js:74:18)
• at /storage/emulated/0/Android/data/com.smartphoneremote.androidscriptfree/files/DroidScript...
• at Script.runInContext ( vm.js:130:18)

the solution that worked for me was to delete the folder node_modules under the project and use the ide.AddModule( "Your_NPM_Library", true ) to reinstall the node library.

Cheers,
WT

Steve Garman

unread,
Feb 4, 2022, 7:04:37 AM2/4/22
to DroidScript
Thanks for posting that WT

Alan Hendry

unread,
Feb 4, 2022, 9:46:05 AM2/4/22
to DroidScript
HI,
I wasn't aware of the 2nd parm, presumably true forces it to download a new copy of the nodejs module.
Is that documented somewhere?
Does it force download every execution (when as an SPK and installed APK/AAB)?
Regards, ah

Steve Garman

unread,
Feb 4, 2022, 10:45:03 AM2/4/22
to DroidScript
The second parameter is overwrite which, if true, forces the module to be downloaded even if it already exists

It is not something you would want to leave in your code once a problem has been fixed

I haven't checked whether it is documented anywhere and I suspect it would be good if it is not
Reply all
Reply to author
Forward
0 new messages