Skip to content

Error: EPERM: operation not permitted on Windows #5085

@eliandoran

Description

@eliandoran

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 TriliumNext/Notes#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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions