Skip to content

I get a write error #4

@cherimo

Description

@cherimo

I use Nodejs v20.15.0

When I add the library I get the following issues:
Code:

import { PersistentNodeCache } from "persistent-node-cache";

const cache = new PersistentNodeCache("mycache", 1000);

cache.set("mykey", "myval", 1000);    //true

cache.get("mykey");

Error:

import { PersistentNodeCache } from "persistent-node-cache";
         ^^^^^^^^^^^^^^^^^^^
SyntaxError: Named export 'PersistentNodeCache' not found. The requested module 'persistent-node-cache' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

Alternative is the following:
Code:

import pkg from 'persistent-node-cache';
const { PersistentNodeCache } = pkg;

const cache = new PersistentNodeCache("mycache", 1000);

cache.set("mykey", "myval", 1000);    //true

cache.get("mykey");

Error:

Error writing to file: [Error: EINVAL: invalid argument, write] {
  errno: -22,
  code: 'EINVAL',
  syscall: 'write'
}

Am I missing something? The permissions are set correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions