Persist node id, keys and names between restart in nodejs

I found this project:

Which works on it’s own and when copied into my project as a git submodule, but when I copy the content of the index.js file into my project:

https://git.sr.ht/~freeduck/nerdy-peters-merch/tree/f40fbec293c9b1ae20fb8f8693c4d60ccae1a7c2/item/helia.js

I get the following error:

node helia.js 
file:///home/kristian/projects/nerdy-peters-merch/node_modules/datastore-fs/dist/src/index.js:154
            throw new NotFoundError(String(err));
                  ^

NotFoundError: Error: ENOENT: no such file or directory, open '/home/kristian/projects/nerdy-peters-merch/data-store/peers/bafzaajaiaejcb5qbumzfp7xrz2opkaeyylato7a5rencqigpsy2tnxsibikssbem.data'
    at FsDatastore.get (file:///home/kristian/projects/nerdy-peters-merch/node_modules/datastore-fs/dist/src/index.js:154:19)
    at async #findExistingPeer (file:///home/kristian/projects/nerdy-peters-merch/node_modules/@libp2p/peer-store/dist/src/store.js:102:33)
    at async PersistentStore.merge (file:///home/kristian/projects/nerdy-peters-merch/node_modules/@libp2p/peer-store/dist/src/store.js:82:47)
    at async PersistentPeerStore.merge (file:///home/kristian/projects/nerdy-peters-merch/node_modules/@libp2p/peer-store/dist/src/index.js:119:28)
    at async DefaultRegistrar.handle (file:///home/kristian/projects/nerdy-peters-merch/node_modules/libp2p/dist/src/registrar.js:64:9)
    at async file:///home/kristian/projects/nerdy-peters-merch/node_modules/libp2p/dist/src/libp2p.js:291:13
    at async Promise.all (index 0)
    at async Libp2pNode.handle (file:///home/kristian/projects/nerdy-peters-merch/node_modules/libp2p/dist/src/libp2p.js:290:9)
    at async Network.start (file:///home/kristian/projects/nerdy-peters-merch/node_modules/@helia/bitswap/dist/src/network.js:63:9)
    at async Bitswap.start (file:///home/kristian/projects/nerdy-peters-merch/node_modules/@helia/bitswap/dist/src/bitswap.js:103:9)

Node.js v20.16.0

Before trying a new thing I delete: /nerdy-peters-merch/data-store

I do not understand why I can’t make it work

Hope you can help

Kind regards

Kristian Nygaard Jensen

Reverting datastore-fs to 9.1.x solved my problem