Error adding external JavaScript library


#1

Hi,
I am trying to add an external JavaScript library (md5.js) in my custom script using require(""). When I run that, I get “Array to string conversion” error. But when I remove the require statement and run, it works fine.

Thanks in advance for the help.


#2

Is this a V8js or Node.js script? For V8js you have to put that md5.js file in the storage/scripting directory. The permissions should match the other files in /scripting (664). Fore Node.js you would use require(“md5”). Just the package name, no ‘.js’ on the end.


#3

It is in V8js. I am using Dream Factory in windows and placed the md5.js file in “C:\Bitnami\dreamfactory-2.1.0-4\apps\dreamfactory\htdocs\storage\scripting” folder. I checked for the permissions and for both the files the permissions are matching. Still I am getting the same error. Please help.


#4

Anything in the log file under storage/logs? In htdocs/.env set APP_DEBUG=true and DF_LOG_LEVEL=DEBUG then try your script.