Skip to content
New issue

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

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

Already on GitHub? # to your account

Fix require warnings #30

Open
bkuhlmann opened this issue Oct 29, 2024 · 2 comments
Open

Fix require warnings #30

bkuhlmann opened this issue Oct 29, 2024 · 2 comments

Comments

@bkuhlmann
Copy link

bkuhlmann commented Oct 29, 2024

Why

Hello. 👋 I'm seeing the following warnings show up when installing packages for a newly built Hanami app:

(node:16225) ExperimentalWarning: CommonJS module /Users/bkuhlmann/.cache/fnm/node-versions/v23.1.0/installation/lib/node_modules/npm/node_modules/debug/src/node.js is loading ES Module /Users/bkuhlmann/.cache/fnm/node-versions/v23.1.0/installation/lib/node_modules/npm/node_modules/supports-color/index.js using require().
Support for loading ES Module in require() is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)

up to date, audited 49 packages in 628ms

14 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

How

You can see this warning pop up when running npm install.

This warning is appearing due to Node 23.0.0's new experimental feature, which is great, but I believe the root is issue is probably with chasing down the dependencies of this project and getting the dependencies to update accordingly.

Notes

  • Node: 23.1.0
  • Hanami: 2.2.0 RC1
@timriley
Copy link
Member

timriley commented Oct 30, 2024

Thanks @bkuhlmann. Any chance you could run node --trace-warnings to show where that warning was created, as that warning suggests, and share the output?

@bkuhlmann
Copy link
Author

Yeah, here's the output:

node --trace-warnings npm install

# node:internal/modules/cjs/loader:1249
#   throw err;
#   ^
# 
# Error: Cannot find module '/Users/bkuhlmann/Scratch/test/npm'
#     at Function._resolveFilename (node:internal/modules/cjs/loader:1246:15)
#     at Function._load (node:internal/modules/cjs/loader:1072:27)
#     at TracingChannel.traceSync (node:diagnostics_channel:322:14)
#     at wrapModuleLoad (node:internal/modules/cjs/loader:216:24)
#     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:170:5)
#     at node:internal/main/run_main_module:36:49 {
#   code: 'MODULE_NOT_FOUND',
#   requireStack: []
# }
# 
# Node.js v23.1.0

Keep in mind, you can easily reproduce this locally via:

hanami new test
cd test
node --trace-warnings npm install

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

No branches or pull requests

2 participants