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

[BUG] (node:63871) ExperimentalWarning: CommonJS module using require() #7942

Closed
2 tasks done
songyang-dev opened this issue Nov 26, 2024 · 2 comments
Closed
2 tasks done
Labels
Bug thing that needs fixing Needs Triage needs review for next steps

Comments

@songyang-dev
Copy link

songyang-dev commented Nov 26, 2024

Is there an existing issue for this?

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

Running npm creates a warning. My installation comes from Homebrew. When I reinstalled the newest version 10.9.1 with the URL in the README, it is still printing the warning.

-> % npm init
(node:64208) ExperimentalWarning: CommonJS module /opt/homebrew/Cellar/node/23.3.0/lib/node_modules/npm/node_modules/debug/src/node.js is loading ES Module /opt/homebrew/Cellar/node/23.3.0/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)
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.

See `npm help init` for definitive documentation on these fields
and exactly what they do.

Use `npm install <pkg>` afterwards to install a package and
save it as a dependency in the package.json file.

Press ^C at any time to quit.
package name: (test) npm warn init canceled

Audit creates a different error code.

-> % npm audit
(node:63871) ExperimentalWarning: CommonJS module /opt/homebrew/Cellar/node/23.3.0/lib/node_modules/npm/node_modules/debug/src/node.js is loading ES Module /opt/homebrew/Cellar/node/23.3.0/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)
found 0 vulnerabilities

Expected Behavior

No warnings

Steps To Reproduce

  1. Create a folder and cd into it.
  2. npm init.

Environment

  • npm: 10.9.1
  • Node.js: v23.3.0
  • OS Name: MacOS 15.1.1
  • System Model Name: MacBook Air
  • npm config:
; node bin location = /opt/homebrew/Cellar/node/23.3.0/bin/node
; node version = v23.3.0
; npm local prefix = /Users/songyang/Desktop/test
; npm version = 10.9.1
; cwd = /Users/songyang/Desktop/test
; HOME = /Users/songyang
; Run `npm config ls -l` to show all defaults.
@songyang-dev songyang-dev added Bug thing that needs fixing Needs Triage needs review for next steps labels Nov 26, 2024
@ljharb
Copy link
Contributor

ljharb commented Nov 26, 2024

Duplicate of #7857.

@wraithgar
Copy link
Member

wraithgar commented Nov 27, 2024

Dupe, adding more comments to other issue as it has more folks subscribed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Needs Triage needs review for next steps
Projects
None yet
Development

No branches or pull requests

3 participants