Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DEP0180] DeprecationWarning: fs.Stats constructor is deprecated when using node 22 #2116

Open
darcyrush opened this issue May 1, 2024 · 2 comments

Comments

@darcyrush
Copy link

Search Terms

DeprecationWarning: fs.Stats

Steps to reproduce the problem

Warning only appears in node 22, node 21 is fine.

(node:4075381) [DEP0180] DeprecationWarning: fs.Stats constructor is deprecated.
    at Object.createResolve (/.../node_modules/ts-node/dist-raw/node-internal-modules-esm-resolve.js:146:25)
    at /.../node_modules/ts-node/src/index.ts:1494:7
    at Object.onceFn [as getNodeEsmResolver] (/.../node_modules/ts-node/src/util.ts:166:13)
    at createEsmHooks (/.../node_modules/ts-node/src/esm.ts:125:51)
    at Object.registerAndCreateEsmHooks (/.../node_modules/ts-node/src/esm.ts:118:10)
    at file:///.../node_modules/ts-node/esm.mjs:8:7
    at ModuleJob.run (node:internal/modules/esm/module_job:235:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:461:24)
    at async Hooks.register (node:internal/modules/esm/hooks:150:26)
    at async MessagePort.handleMessage (node:internal/modules/esm/worker:199:18)

The line of code in question;

const statsIfNotFound = new Stats();

Minimal reproduction

node --trace-deprecation --import ./ts-node.register.mjs path/to/any/file.ts

With ts-node.register.mjs containing the lines of code suggested here.

Specifications

  • ts-node version: 10.9.1
  • node version: v22.0.0
  • TypeScript version: 5.4.5
  • Operating system and version: Ubuntu 22.04 LTS, 5.15.0-105-generic x86_64
@Byron2016
Copy link

maybe some update on this warning?

@RomainLanz
Copy link

We made ts-node-maintained in the meanwhile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants