nodejs/help

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

chouck-pthreemedia opened this issue · 4 comments

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.

@babel/types/lib/index.js:66, all definteProperty caused the error
Cannot redefine property: __internal__deprecationWarning
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

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

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

│ Cannot redefine property: __internal__deprecationWarning │
│ │
│ To investigate the issue, examine this stack trace: │
│ at defineProperty │
│ at (@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 (@babel/types/src/builders/validateNode.ts:3) │
│ import { BUILDER_KEYS } from "../index.ts"; │
│ at _compile (node:internal/modules/cjs/loader:1241)

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