Modules routinely not found.. Running on a Mac


This is my first plugin, so please bare with me.

I’m working on developing a plugin for XD. I have redesigned approach in my script several times. All for the same reason. In my previous script, I had a bunch of modules:
const scenegraph = require(“scenegraph”);
const storage = require(“uxp”).storage;
const fs = require(“uxp”).storage.localFileSystem;
const application = require(‘application’)
const Dialogs = require(‘./lib/dialogs’)
global.setTimeout = /** @type {any} */(global.setTimeout || ((fn) => fn()))
const Compress = require(‘./lib/compress’)
const Folder = storage.Folder
*const { CSVExporter } = require(“@adobe/xd-file-utils”);
const clipboard = require(“clipboard”);

All except for the CSVExporter module would allow the plugin to load from UXP without any errors in the console. The main error was:
Plugin Error: Module not found: “CSVExporter”. Parent module folder was: “/”.

Since then, I’ve redesigned my script. It’s more efficient and only relies on 2 modules:
const scenegraph = require(“scenegraph”);
const axios = require(‘axios’);

I get the same error in XD’s console. Here’s the complete error.
Plugin Error: Error loading plugin from path: (Directory where my plugin folder is)
Plugin Error: Module not found: “axios”. Parent module folder was: “/”.
at e.exports._throwModuleNotFound (uxp://uxp-internal/runtime_scripts_loader.js:2:17492)
at e.exports._require (uxp://uxp-internal/runtime_scripts_loader.js:2:18271)
at t (uxp://uxp-internal/runtime_scripts_loader.js:2:17730)
at /Volumes/Areca 12/Shane_Live/Developer/Callout Application/UXP/XDStarter2/main.js:2:15
at e.exports._loadModule (uxp://uxp-internal/runtime_scripts_loader.js:2:19521)
at e.exports.loadMainModule (uxp://uxp-internal/runtime_scripts_loader.js:2:17111)
at Object.loadMainFile (uxp://uxp-internal/pluginmanager_scripts.js:2:34455)
at D.loadMainFile (uxp://uxp-internal/pluginmanager_scripts.js:2:48503)
at loadPlugin (plugins/PluginLoader.js:1:590)
at M.handlePluginLoad (plugins/PluginLoader.js:1:11137)
at convertPluginErrorToString (plugins/PluginErrorUtil.js:1:198)
at safeGetStackTrace (plugins/PluginErrorUtil.js:1:339)
at internalFormatPluginError (plugins/PluginErrorUtil.js:1:1055)
at internalReportPluginError (plugins/PluginErrorUtil.js:1:1153)
at Object.reportPluginError (plugins/PluginErrorUtil.js:1:1766)
at loadPlugin (plugins/PluginLoader.js:1:1168)
at M.handlePluginLoad (plugins/PluginLoader.js:1:11137)
at uxp://uxp-internal/domjs_scripts.js:2:8982
at I (uxp://uxp-internal/domjs_scripts.js:2:8874)
at uxp://uxp-internal/domjs_scripts.js:2:8366
at O (uxp://uxp-internal/domjs_scripts.js:2:8373)
at k (uxp://uxp-internal/domjs_scripts.js:2:9151)
at M._onNativeEvent (uxp://uxp-internal/pluginmanager_scripts.js:2:12189)

I’ve reinstalled and updated npm and Node.js to latest versions. I think I’ve done it correctly. Of course, I’ve also installed axios via npm. Also tried installing axios with pnpm as I ran out of ideas.

Any help would be GREATLY appreciated. Also, if you do have a solution, please explain as you would to someone who is brand new to coding. THANKS!!