nodejs / help

:sparkles: Need help with Node.js? File an Issue here. :rocket:
1.47k stars 280 forks source link

Node v20.6.0 threw '__internal__deprecationWarning' for React Shopify Hydrogen; reverting to v20.5.1 fixed it #4241

Closed chouck-pthreemedia closed 4 months ago

chouck-pthreemedia commented 1 year ago

Details

I recently encountered issues while trying to run a project that relies on a stack of several packages. The application would not launch, and I was met with various errors related to __internal__deprecationWarning and other named exports not being found. After much troubleshooting, it seems these were caused by upgrading to Node v20.6.0.

Expected Behavior: The project should build and run without issues.

Actual Behavior: Received errors related to __internal__deprecationWarning and named exports not being found in certain modules like @babel/types.

Temporary Solution: Downgrading Node.js to version v20.5.1 and rerunning the project resolved the issue, suggesting the problem is specific to version v20.6.0.

Node.js version

v20.6.0

Example code

@babel/types/lib/index.js:66, all definteProperty caused the error

The first snippet looked like this:

Object.defineProperty(exports, "__internal__deprecationWarning", {
  enumerable: true,
  get: function () {
    return _deprecationWarning.default;
  }
});

and returned this error upon trying to launch with npm run dev:

╭─ error ──────────────────────────────────────────────────────────────────────╮
│                                                                              │
│  Cannot redefine property: __internal__deprecationWarning                    │
│                                                                              │
│  To investigate the issue, examine this stack trace:                         │
│    at defineProperty                                                         │
│    at <anonymous> (@babel/types/lib/index.js:66)                             │
│      Object.defineProperty(exports, "__internal__deprecationWarning", {      │
│    at _compile (node:internal/modules/cjs/loader:1241)                       │
│    at js (node:internal/modules/cjs/loader:1295)                             │
│    at load (node:internal/modules/cjs/loader:1091)                           │
│    at _load (node:internal/modules/cjs/loader:938)                           │
│    at require (node:internal/modules/cjs/loader:1115)                        │
│    at require (node:internal/modules/helpers:130)                            │
│    at <anonymous> (@babel/types/src/builders/validateNode.ts:3)              │
│      import { BUILDER_KEYS } from "../index.ts";                             │
│    at _compile (node:internal/modules/cjs/loader:1241)                       │
│                                                                              │
╰──────────────────────────────────────────────────────────────────────────────╯

The next several dozen defineProperty would throw the same error.

Operating system

macOS

Scope

Upon attempting to launch the hydrogen environment to continue developing.

Module and version

Not applicable.

preveen-stack commented 1 year ago

@babel/types/lib/index.js:66, all definteProperty caused the error Cannot redefine property: internaldeprecationWarning The next several dozen defineProperty would throw the same error Temporary Solution: Downgrading Node.js to version v20.5.1 and rerunning the project resolved the issue, suggesting the problem is specific to version v20.6.0.

Let's check with release

cc @nodejs/releasers PTAL and advise

RafaelGSS commented 1 year ago

We should have a reproducible example. But, if you know this is working fine on v20.5.1. A git bisect might be desirable.

brovacs007 commented 1 year ago

Getting the following on 20.6.1 and newer. Forgive me as I am new to this.

│ Cannot redefine property: internaldeprecationWarning │ │ │ │ To investigate the issue, examine this stack trace: │ │ at defineProperty │ │ at (@babel/types/lib/index.js:66) │ │ Object.defineProperty(exports, "internaldeprecationWarning", { │ │ at _compile (node:internal/modules/cjs/loader:1241) │ │ at js (node:internal/modules/cjs/loader:1295) │ │ at load (node:internal/modules/cjs/loader:1091) │ │ at _load (node:internal/modules/cjs/loader:938) │ │ at require (node:internal/modules/cjs/loader:1115) │ │ at require (node:internal/modules/helpers:130) │ │ at (@babel/types/src/builders/validateNode.ts:3) │ │ import { BUILDER_KEYS } from "../index.ts"; │ │ at _compile (node:internal/modules/cjs/loader:1241)

mcollina commented 1 year ago

You should likely open an issue in babel or react native, that's not one of our errors.

github-actions[bot] commented 5 months ago

It seems there has been no activity on this issue for a while, and it is being closed in 30 days. If you believe this issue should remain open, please leave a comment. If you need further assistance or have questions, you can also search for similar issues on Stack Overflow. Make sure to look at the README file for the most updated links.

RedYetiDev commented 4 months ago

You should likely open an issue in babel or react native, that's not one of our errors.

Closing