升级Node.js至8.10后VS Code调试Node Lambda失败求助
Let's break down what's going on here and fix that frustrating "Runtime [nodejs8.10] is not supported" error.
Root Cause
The problem isn't with VS Code—it's coming from your node-lambda tool. Older versions of node-lambda don't recognize Node.js 8.10 as a valid runtime, since they were built to work with older Node releases like 6.10. That's why the error popped up right after your Node version upgrade.
Step 1: Upgrade node-lambda to a compatible version
First, you need to get a newer version of node-lambda that supports Node 8.10.
- Uninstall the outdated global version:
npm uninstall -g node-lambda - Install the latest stable version:
npm install -g node-lambda
If you're using node-lambda as a local project dependency instead of a global tool, update its version in your package.json and run npm install to pull in the new release.
Step 2: Fix your VS Code Debug Configuration
Your current config has the protocol line commented out—but Node.js 8.x relies on the inspector protocol for debugging. Update your launch config to enable this:
{ "version": "0.2.0", "configurations": [ { "type": "node", "request": "launch", "name": "Debug Node Lambda ", "program": "/usr/local/bin/node-lambda", "args": [ "run" ], "preLaunchTask": "debug", "postDebugTask": "clean", "runtimeVersion": "8.10.0", "protocol": "inspector" } ] }
Step 3: Explicitly Specify the Runtime (If Needed)
If you still see the error after upgrading, force node-lambda to use the correct runtime by adding it to your debug arguments:
Modify the args array in your config to:
"args": [ "run", "--runtime", "nodejs8.10" ]
Step 4: Double-Check Your Node Environment
Make sure VS Code is using the right Node 8.10 version managed by nvm:
- Open the VS Code terminal and run
node -vto confirm it outputsv8.10.0. - If it shows a different version, run
nvm use 8.10.0in the terminal to switch to the correct environment before starting the debugger.
That should get your VS Code debugger working smoothly with Node 8.10 and node-lambda again!
内容的提问来源于stack exchange,提问作者negstek

