TriliumNext / Notes

Build your personal knowledge base with TriliumNext Notes
GNU Affero General Public License v3.0
655 stars 31 forks source link

Error: EPERM: operation not permitted on Windows #249

Open eliandoran opened 1 month ago

eliandoran commented 1 month ago

Steps to reproduce:

  1. Remove data directory.
  2. Finish the first setup.
  3. Restart the server.
  4. Log in.

The error occurs only on Windows systems.

First discussed in #228 .

We get an error:

[Error: EPERM: operation not permitted, rename 'C:\Users\Elian\Projects\TriliumNext\data\sessions\WMCk1bAlG6HCBjNajFh-NPcVNZlF1dKn.json.1509196086' -> 'C:\Users\Elian\Projects\TriliumNext\data\sessions\WMCk1bAlG6HCBjNajFh-NPcVNZlF1dKn.json'] {
  errno: -4048,
  code: 'EPERM',
  syscall: 'rename',
  path: 'C:\\Users\\Elian\\Projects\\TriliumNext\\data\\sessions\\WMCk1bAlG6HCBjNajFh-NPcVNZlF1dKn.json.1509196086',
  dest: 'C:\\Users\\Elian\\Projects\\TriliumNext\\data\\sessions\\WMCk1bAlG6HCBjNajFh-NPcVNZlF1dKn.json'
}

followed by another:

Error: Cannot set headers after they are sent to the client
    at ServerResponse.setHeader (node:_http_outgoing:659:11)
    at ServerResponse.header (C:\Users\Elian\Projects\TriliumNext\node_modules\express\lib\response.js:794:10)
    at ServerResponse.json (C:\Users\Elian\Projects\TriliumNext\node_modules\express\lib\response.js:275:10)
    at ServerResponse.send (C:\Users\Elian\Projects\TriliumNext\node_modules\express\lib\response.js:162:21)
    at C:\Users\Elian\Projects\TriliumNext\src\routes\error_handlers.ts:36:13
    at Layer.handle_error (C:\Users\Elian\Projects\TriliumNext\node_modules\express\lib\router\layer.js:71:5)
    at trim_prefix (C:\Users\Elian\Projects\TriliumNext\node_modules\express\lib\router\index.js:326:13)
    at C:\Users\Elian\Projects\TriliumNext\node_modules\express\lib\router\index.js:286:9
    at Function.process_params (C:\Users\Elian\Projects\TriliumNext\node_modules\express\lib\router\index.js:346:12)
    at next (C:\Users\Elian\Projects\TriliumNext\node_modules\express\lib\router\index.js:280:10)
eliandoran commented 1 month ago

The culprit appears to be session-file-store as per https://github.com/valery-barysok/session-file-store/issues/69. No straight-forward solution apart from replacing session-file-store with something else.

eliandoran commented 1 month ago

The issue is reproducible on Trilium Notes 0.63.7 as well, so not a regression.