configstore icon indicating copy to clipboard operation
configstore copied to clipboard

v5 is not working with SNAP

Open p3x-robot opened this issue 5 years ago • 5 comments

patrikx3@bitang:~$ /snap/bin/p3x-onenote 
A JavaScript error occurred in the main process
Uncaught Exception:
Error: EPERM: operation not permitted, chown '/home/patrikx3/snap/p3x-onenote/21/.config/configstore/p3x-onenote.json.994378042'
    at Object.chownSync (fs.js:1064:3)
    at Function.writeFileSync [as sync] (/snap/p3x-onenote/21/resources/app.asar/node_modules/write-file-atomic/index.js:196:27)
    at Configstore.set all [as all] (/snap/p3x-onenote/21/resources/app.asar/node_modules/configstore/index.js:61:20)
    at Configstore.set (/snap/p3x-onenote/21/resources/app.asar/node_modules/configstore/index.js:91:12)
    at Object.<anonymous> (/snap/p3x-onenote/21/resources/app.asar/src/electron/app.js:56:10)
    at Object.<anonymous> (/snap/p3x-onenote/21/resources/app.asar/src/electron/app.js:111:3)
    at Module._compile (internal/modules/cjs/loader.js:693:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:704:10)
    at Module.load (internal/modules/cjs/loader.js:602:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:541:12)
/usr/share/libdrm/amdgpu.ids: No such file or directory

When I revert to configstore v4 and install on SNAP it works 100%.
With v5 it tries to chown a file, that is not permitted on SNAP.

p3x-robot avatar Jun 24 '19 16:06 p3x-robot

of course this error is, that you cannot use chown in snap...

p3x-robot avatar Jun 24 '19 16:06 p3x-robot

https://github.com/npm/write-file-atomic/blame/73c3b6f94ce7d57f63d30d4b7b33f17d4004bf1e/index.js#L196

p3x-robot avatar Jun 24 '19 16:06 p3x-robot

https://github.com/npm/write-file-atomic/issues/49

p3x-robot avatar Jun 24 '19 16:06 p3x-robot

https://github.com/yeoman/configstore/blame/764ac63d17de9e3d322c1c42180a8d5bec85391a/index.js#L14

that line would work like this:

const writeFileOptions = {mode: 0o0600, chown: false};

actually it is still not work, as if it is chown : false it will build the chown setting, there is no way to disable chown right now

p3x-robot avatar Jun 24 '19 16:06 p3x-robot

I think this could be fixed by switching to use https://github.com/fabiospampinato/atomically

sindresorhus avatar Jul 17 '20 19:07 sindresorhus