MaowImpl

Furry
Member
Joined
Sep 21, 2014
Messages
9
Reaction score
6
First Language
English
Primarily Uses
RMMV


Prelude

Hello! Here's a tutorial on installing external dependencies in RPG Maker MV since I couldn't find any other sources for it after looking for hours, so it took me a bit of time to figure this out myself.

Note: This works without a bundler (like Rollup.js) or TypeScript, but I have yet to test if it works with them.



1. Install Node.js

Skip this section if you already have Node.js installed; otherwise, continue onwards.
You will need to download Node.js as it comes with NPM, a tool with which we will install dependencies. Link here.

2. Install Dependencies

To install a dependency, you need to open up your terminal and go to your game directory, then, once you're there, type npm i <name> (e.g. discord-rpc, ws, ...), this will install said dependency into a newly created node_modules folder.

3. Using Dependencies with Node.js's require(...)

This is really easy, just declare a new variable in your script like const Thing = require('name-of-the-module');, and then you can use it normally just fine.

4. After Deployment

Now, making the newly installed dependencies work with a production build (AKA a copy of your game meant to be played by users, not you, the developer) is a slight hindrance, but doesn't take long at all.
You need to move the node_modules folder from the www to the root folder (AKA the one containing your Game.exe), you can also delete the additional package.json and package-lock.json in www (not the root folder, do not delete the package.json in the root as Game.exe requires it)

5. Done!

You should be good to go now, if I missed anything make sure to tell me.
 

MaowImpl

Furry
Member
Joined
Sep 21, 2014
Messages
9
Reaction score
6
First Language
English
Primarily Uses
RMMV
Note: This might not even work on other platforms, I've only tested it on Windows, and it would probably work on Linux, but I'm skeptical about Mac, browser, and mobile. Make sure to tell me if you do get it to work so I can add a new section to the tutorial.

Addendum: NW.js

It's also possible that this only works with an updated version of NW.js (what RPG Maker MV uses to run games on desktop) since it works for me and I did update my NW.js manually.

In order to update NW.js, you need to download a copy of the runtime and SDK at the official site, and replace the files in your RPG Maker MV/nw-win and RPG Maker MV/nw-win-test folders (RPG Maker MV would be in your Steam folder if you installed it on Steam).

I recommend keeping a backup of both folders in case that breaks anything, but it's unlikely.
 

Latest Threads

Latest Profile Posts

Fire-Emblem Style Level Up System, Boost on Class Change, And Animated Arrows | RPG Maker News #115

Why keyboards don't sleep? Because they have two shifts.
I realized a while ago my game was toooo big in scope. even now I wonder am I trying to do too much by myself. and that's after completely changing the format of the game.
Last week at SLC. Cali awaits. TBH I love SLC more than SF.
Back home now. I had a good time, but I had a checkup this morning so I had to come home for that. Now I'm just waiting for my therapist meeting tomorrow...
Decided to work on Wishful Wanda today. Since it's a BFB spinoff game, I decided to make the Huang brothers
Easter eggs! I'm actually pitching this to the BFDI team, btw.

Forum statistics

Threads
113,934
Messages
1,078,522
Members
148,044
Latest member
Sernyx
Top