#1407·gun

Problem with packaging GUN application using pkg

Author: LAKSHYAJAIN16Created Jun 8, 2025Updated Jun 25, 2025

Hi!

I'm developing an app which requires me to package my gun app using pkg.

The app loads successfully, but every 2 seconds or so I get this error

Error: Cannot write to packaged file
    at writeToSnapshot (pkg/prelude/bootstrap.js:964:16)
    at Object.write (pkg/prelude/bootstrap.js:980:12)
    at writeAll (node:fs:2126:6)
    at node:fs:2191:7
    at zalgoSafe (pkg/prelude/bootstrap.js:432:10)
    at pkg/prelude/bootstrap.js:766:9
    at FSReqCallback.oncomplete (node:fs:201:23)

Here's the code

// gun-server.js
const Gun = require('gun');
require('gun/sea');
require('gun/lib/webrtc');

const http = require('http');
const server = http.createServer().listen(8765);

Gun({ web: server });

console.log(' GunDB peer running at http://localhost:8765/gun');

Terminal

Image

nothing too complicated. how do i resolve this error?