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

Node 22: fs.Stats constructor is deprecated #246

Closed
RobinTail opened this issue Apr 24, 2024 · 4 comments
Closed

Node 22: fs.Stats constructor is deprecated #246

RobinTail opened this issue Apr 24, 2024 · 4 comments

Comments

@RobinTail
Copy link

RobinTail commented Apr 24, 2024

For your information, this warning appears when running vitest in Node 22 environment:

(node:2057) [DEP0180] DeprecationWarning: fs.Stats constructor is deprecated.

I managed to figure out that it comes from mlly being the dependency of vitest:

=> Found "mlly@1.6.1"
info Reasons this module exists
   - "vitest#local-pkg" depends on it
   - Hoisted from "vitest#local-pkg#mlly"
   - Hoisted from "vitest#local-pkg#pkg-types#mlly"

The exact statement causing the issue is not present in the source code of mlly, but is generated in its build/distribution by rollup:

image

Consider upgrading rollup and its relatives, or adjust the line of code that may lead to that statement in production.

There is also a duplication of rollup in your lock file:

mlly/pnpm-lock.yaml

Lines 2171 to 2176 in c282adb

rollup@3.29.4:
resolution: {integrity: sha512-oWzmBZwvYrU0iJHtDmhsm662rC15FRXmcjCk1xD771dFDx5jJ02ufAQQTn0etB2emNk4J9EZg/yWKpsn9BWGRw==}
engines: {node: '>=14.18.0', npm: '>=8.0.0'}
hasBin: true
rollup@4.9.4:

@RobinTail RobinTail changed the title Node 22: DeprecationWarning: fs.Stats constructor is deprecated Node 22: fs.Stats constructor is deprecated Apr 24, 2024
@srbarba
Copy link

srbarba commented Apr 30, 2024

Same problem nuxt:

nuxt/cli#405

@danielroe
Copy link
Member

danielroe commented Apr 30, 2024

This was an upstream issue (wooorm/import-meta-resolve#27) which is resolved in v4.1.0 of import-meta-resolve, but because mlly inline import-meta-resolve, it may take a little while for the fix to percolate downward.

@pi0
Copy link
Member

pi0 commented May 1, 2024

Fix already merged via #249

@pi0
Copy link
Member

pi0 commented May 1, 2024

https://github.com/unjs/mlly/releases/tag/v1.7.0


For nuxt users, you need a new nuxi release please followup via nuxt/cli#405

@pi0 pi0 closed this as completed May 1, 2024
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

4 participants