serverless / serverless

⚡ Serverless Framework – Effortlessly build apps that auto-scale, incur zero costs when idle, and require minimal maintenance using AWS Lambda and other managed cloud services.
https://serverless.com
MIT License
46.66k stars 5.74k forks source link

Serverless using the wrong node version causes TypeError: Cannot redefine property: _serverlessExternalPluginName #12937

Closed JarrenBack closed 4 months ago

JarrenBack commented 4 months ago

Issue description

I'm getting the following error[1] when trying to run serverless deploy. This error message lists node 23.3.0 as the node environment, but when I run node -v, it gives v20.18.1. I'm not sure why serverless is using node 23.3.0. I've checked my .bash_profile and .zshrc files, but they do not contain a reference to node 23. I've tried running commands like brew link/unlink and nvm use 20, but no luck

[1]

Running "serverless" from node_modules (node:4823) [DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead. (Use node --trace-deprecation ... to show where the warning was created) Environment: darwin, node 23.3.0, framework 3.39.0 (local) 3.39.0v (global), plugin 7.2.3, SDK 4.5.1 Docs: docs.serverless.com Support: forum.serverless.com Bugs: github.com/serverless/serverless/issues

Error: TypeError: Cannot redefine property: _serverlessExternalPluginName at Function.defineProperty () at PluginManager.resolveServicePlugins (/Users/jarren/workspace/web-application/backend/node_modules/serverless/lib/classes/plugin-manager.js:230:14) at async PluginManager.loadAllPlugins (/Users/jarren/workspace/web-application/backend/node_modules/serverless/lib/classes/plugin-manager.js:136:36) at async Serverless.init (/Users/jarren/workspace/web-application/backend/node_modules/serverless/lib/serverless.js:146:5) at async /Users/jarren/workspace/web-application/backend/node_modules/serverless/scripts/serverless.js:601:7 (node:4823) ExperimentalWarning: CommonJS module /Users/jarren/workspace/web-application/backend/node_modules/serverless/lib/utils/require-with-import-fallback.js is loading ES Module /Users/jarren/workspace/web-application/backend/node_modules/@haftahave/serverless-ses-template/dist/esm/index.js using require(). Support for loading ES Module in require() is an experimental feature and might change at any time

Context

In serverless.yml, we have a runtime of nodejs20.x provider: name: aws runtime: nodejs20.x

JarrenBack commented 4 months ago

I found a resolution. I was on serverless version 3.39.0 which forces node 23, but when I went back to version 3.26.0, I was able to use node 20

Edward-Tanner commented 1 month ago

@JarrenBack I think we should re-open this as it is currently breaking with Node version higher then 20.18.3. When using 20.19 this breaks but after downgrading to 20.18.3 it will builds.

milesmmoran commented 1 month ago

@JarrenBack I think we should re-open this as it is currently breaking with Node version higher then 20.18.3. When using 20.19 this breaks but after downgrading to 20.18.3 it will builds.

Experiencing the same thing. Is the move to downgrade with the runtime arn?