MV How to prevent package JSON file to reset settings

Hi everyone,

I updated the NW.js version in my RPG Maker MV project so I could use a specific plugin. After following a tutorial to replace the NW.js files, I had trouble launching playtests (small black window in the upper-left side of my screen. The sound of my game start playing but you can't see anything. There's no top bar and no program icon in the windows task bar so I have to close the 'nwjs' program in the task manager to close it.).

Someone on another forum suggested opening package.json and removing "fullscreen": true, which fixed the playtest issue.

However, every time I launch a new playtest, the package.json file resets and "fullscreen": true appears again. This means I have to remove it manually every time.

Why does package.json reset at every playtest? How can I permanently edit it so the change stays?

I haven't found many posts about this problem or any clear solution.

Thanks for any help!
Try setting the package.json file to "Read-only" via the OS file explorer.
Try setting the package.json file to "Read-only" via the OS file explorer.
This prevents the file to reset itself but ends up in an error message (Error: EPERM: operation not permitted, open C:\...\package.json)
Oh. Normally that's OK (at least on Windows): it shows a warning message in the editor when trying to save the project, but retrying makes everything work with no problems. 😅

Some ideas:
  1. When does the EPERM error appear? If you see the playtest window appear then I think that means a plugin is responsible. Otherwise it may be related to your NWJS update.

  2. Maybe one or more of your plugins attempt to write to that file on game boot, e.g. I think one of SRD's plugins does that. Or maybe the original problem is due to a plugin conflict. You could try temporarily turning off all plugins to see if that makes a difference. Remember to save your project to apply Plugin Manager changes before testing~

  3. If the error still appears with all plugins turned off, it's almost certainly a NWJS thing. Since both the plugin author and tutorial video claim it's normally OK to upgrade NWJS, maybe you made a mistake somewhere, or chose a different, incompatible version.
I've personally never tried to upgrade NWJS...maybe someone more familiar with the process will recognise your problem.
Oh. Normally that's OK (at least on Windows): it shows a warning message in the editor when trying to save the project, but retrying makes everything work with no problems. 😅

Some ideas:
  1. When does the EPERM error appear? If you see the playtest window appear then I think that means a plugin is responsible. Otherwise it may be related to your NWJS update.

  2. Maybe one or more of your plugins attempt to write to that file on game boot, e.g. I think one of SRD's plugins does that. Or maybe the original problem is due to a plugin conflict. You could try temporarily turning off all plugins to see if that makes a difference. Remember to save your project to apply Plugin Manager changes before testing~

  3. If the error still appears with all plugins turned off, it's almost certainly a NWJS thing. Since both the plugin author and tutorial video claim it's normally OK to upgrade NWJS, maybe you made a mistake somewhere, or chose a different, incompatible version.
I've personally never tried to upgrade NWJS...maybe someone more familiar with the process will recognise your problem.
So I turned every plugin off and it worked. The problem appeared when I turned YEP's Core Engine on.
I still need the plugin for my project but I guess YEP's plugin isn't compatible with the NW.js version (0.49.2)? Do you know if there's an update or some equivalent plugin?

Btw I'm on Windows 11 using RPG Maker MV on Steam and the EPERM error message appears inside of the playtest window directly at the start.
The problem appeared when I turned YEP's Core Engine on.
I still need the plugin for my project but I guess YEP's plugin isn't compatible with the NW.js version (0.49.2)? Do you know if there's an update or some equivalent plugin?
You linked to Yanfly's site, so I assume you're using the latest version...? 😅

To find exactly where the error occurs, you can press F8 or F12 during playtest to open the dev tools window: detailed error information can be found on the Console tab of that window, in red text. If you want someone to write a compatibility patch for when the manifest file is read-only, then a screenshot of that error information could be helpful. 👋

In terms of a replacement, it depends exactly what you need from it. Yanfly's Core Engine does a lot of different things! (Also, unless you saw this happen with only YEP_CoreEngine enabled, it might be a combination of plugins causing the issue.)
Okay so I just tried turning YEP's plugins on (Core Engine, Message Core, ExtMesPack1, Questjournal) and turned every SRD plugins off (SRD PreloaderCore, SRD GameUpgrade, SRD CreditsPlugin) and the playtest seems to work AND the package.json stopped resetting itself! Are the YEP and SRD plugins known to have compatibility issues? I feel like it's weird that the project worked fine before I updated the NW.js and I'm worried that I just messed up somewhere.

I think it will be easier to just find other plugins to replace the SRD ones.
I feel like it's weird that the project worked fine before I updated the NW.js and I'm worried that I just messed up somewhere.
You seem to be losing track of the problem. This was your original question:
Someone on another forum suggested opening package.json and removing "fullscreen": true, which fixed the playtest issue.

However, every time I launch a new playtest, the package.json file resets and "fullscreen": true appears again. This means I have to remove it manually every time.

Why does package.json reset at every playtest? How can I permanently edit it so the change stays?
So you had it working, but then you needed a way to lock in the change. I suggested setting the manifest to read-only, which worked but caused the file permissions error:
This prevents the file to reset itself but ends up in an error message (Error: EPERM: operation not permitted, open C:\...\package.json)
So now you can try to track down the plugin that is trying to edit that file on game boot.

Okay so I just tried turning YEP's plugins on (Core Engine, Message Core, ExtMesPack1, Questjournal) and turned every SRD plugins off (SRD PreloaderCore, SRD GameUpgrade, SRD CreditsPlugin) and the playtest seems to work
Seems like my original guess was correct:
Maybe one or more of your plugins attempt to write to that file on game boot, e.g. I think one of SRD's plugins does that.
I think one of their plugins edits the manifest (i.e. package.json) when the game boots, then relaunches the game with the new settings. I don't remember which one...it might be Game Upgrade?

Without the error information from the console, all I can suggest for tracking down the plugin responsible (I assume it's only one, not multiple) is to test once per suspect:
  1. Turn off all plugins.
  2. Turn on one plugin.
  3. Save your project to apply Plugin Manager changes.
  4. Playtest to see if the error occurs.
Alternatively you could post screenshot(s) of your Plugin Manager and someone might spot a likely culprit.

The plugin responsible for this might actually be configurable, either to launch with fullscreen disabled as you originally wanted (so you don't have to set the manifest to read-only), or to avoid editing the manifest entirely. Or maybe that plugin was responsible for the window layout problems in the first place, e.g. due to outdated NWJS API calls. No-one can tell without knowing which plugin it is.

I think it will be easier to just find other plugins to replace the SRD ones.
Of course, you're free to do that instead if you want; it's your project~
Thanks for setting me straight, haha.

I did indeed identify the plugin that was causing the problem: SRD Game Upgrade.

I checked the settings and sure enough, the “fullscreen” option was enabled.
So I disabled it, and now the game works perfectly.

Thank you so much for all the advice and your patience!

Original thread: https://forums.rpgmakerweb.com/threads/how-to-prevent-package-json-file-to-reset-settings.182815/