Skip to content

ENOENT when using @datocms/cma-client-node on a Windows machine #39

@vinixhenri

Description

@vinixhenri

Getting the error below once the require of the @datocms/cma-client-node is added with:
const { buildClient } = require('@datocms/cma-client-node')
This only happens in a Windows machine (tried with PowerShell and git bash, both get the same error).
On a Mac computer it works fine.

{
  "errorMessage": "ENOENT: no such file or directory, lstat 'C:\\Users\\user\\Desktop\\workspace\\project\\serverless\\undefined'",
  "errorType": "Error",
  "stackTrace": [
    "Error: ENOENT: no such file or directory, lstat 'C:\\Users\\user\\Desktop\\workspace\\project\\serverless\\undefined'",
    "at Object.realpathSync (node:fs:2787:29)",
    "at _getTmpDirSync (C:\\Users\\user\\Desktop\\workspace\\project\\serverless\\node_modules\\tmp\\lib\\tmp.js:728:13)",
    "at Object.get [as tmpdir] (C:\\Users\\user\\Desktop\\workspace\\project\\serverless\\node_modules\\tmp\\lib\\tmp.js:829:12)",
    "at Object.\u003Canonymous\u003E (C:\\Users\\user\\Desktop\\workspace\\project\\serverless\\node_modules\\tmp-promise\\index.js:48:29)",
    "at Module._compile (node:internal/modules/cjs/loader:1730:14)",
    "at Object..js (node:internal/modules/cjs/loader:1895:10)",
    "at Module.load (node:internal/modules/cjs/loader:1465:32)",
    "at Function._load (node:internal/modules/cjs/loader:1282:12)",
    "at TracingChannel.traceSync (node:diagnostics_channel:322:14)"
  ]
}

PC Info:

System:
OS: Windows 11 10.0.26100
CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
Memory: 3.07 GB / 15.73 GB
Binaries:
Node: 22.15.0 - ~.nvm\versions\node\v22.15.0\bin\node.EXE
Yarn: 1.22.22 - ~.nvm\versions\node\v22.15.0\bin\yarn.CMD
npm: 10.9.2 - ~.nvm\versions\node\v22.15.0\bin\npm.CMD

Reproduction

Basically install it and require of package already gets you this error on a Windows machine, but in my case it's setup on a serverless with serverless-offline + express.

@datocms/cma-client-node: 5.1.23

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions