SalesforceCommerceCloud / pwa-kit

React-based JavaScript frontend framework to create a progressive web app (PWA) storefront for Salesforce B2C Commerce.
https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/pwa-kit-overview.html
BSD 3-Clause "New" or "Revised" License
276 stars 126 forks source link

[BUG] Unsupported engine on NodeJS 22, NPM 10 #1814

Closed brianmfear closed 1 week ago

brianmfear commented 1 month ago

Summary

After npm init lwr@latest and installing dependencies, starting the server (npm run dev) emits this message:

[config] peer dependency pwa-kit-runtime was not provided

Attempting to resolve with npm install pwa-kit-runtime results in the following:

npm warn EBADENGINE Unsupported engine {
npm warn EBADENGINE   package: 'pwa-kit-runtime@2.8.3',
npm warn EBADENGINE   required: {
npm warn EBADENGINE     node: '^14.0.0 || ^16.0.0 || ^18.0.0',
npm warn EBADENGINE     npm: '^6.14.4 || ^7.0.0 || ^8.0.0 || ^9.0.0'
npm warn EBADENGINE   },
npm warn EBADENGINE   current: { node: 'v22.1.0', npm: '10.7.0' }
npm warn EBADENGINE }

Steps To Reproduce

npm init lwr@latest
# follow prompts
cd projectDir
npm install
npm run dev

Expected result

Everything should work. Opening a browser should show the hello world app with Codey the Bear.

Actual result

Console errors:

Error: [LWC error]: LWC WARNING: current engine is v5.0.0, but template was compiled with v6.6.5. Please update your compiled code or LWC engine so that the versions match. No further warnings will appear. at log (lwc.js:557:11) at logError (lwc.js:564:3) at checkVersionMismatch (lwc.js:3142:7) at registerTemplate (lwc.js:3164:5) at example_app_app_html.js:14:16

Uncaught (in promise) TypeError: node.cloneNode is not a function at cloneNode (lwc.js:8601:19) at mountStatic (lwc.js:4728:27) at mount (lwc.js:4618:7) at mountVNodes (lwc.js:4875:7) at updateStaticChildren (lwc.js:5370:5) at patchChildren (lwc.js:4558:5) at lwc.js:6755:9 at runWithBoundaryProtection (lwc.js:6985:5) at patchShadowRoot (lwc.js:6750:7) at rehydrate (lwc.js:6733:5)

Browser: Version 125.0.6422.112 (Official Build) (64-bit) Node version: Node 22.1.0 pwa-kit version: ??? Desktop OS: Microsoft Windows [Version 10.0.22621.3593] (Windows 11) Mobile Device Info: (N/A)

drewzboto commented 1 month ago

@brianmfear thanks for opening this. Node 22 isn't supported yet. see what versions are supported here, as Managed Runtime is the currently targeted deployment infrastructure.

We intend to add Node 22 support closer to the end of 2024, once our underlying public cloud provider also adds similar support.

Please use Node 20 in the meantime.