Fix: Ensure compatibility with Express 4.x and 5.x in ExpressPlugin#125
Closed
thiagomatar wants to merge 3 commits intoapache:masterfrom
Closed
Fix: Ensure compatibility with Express 4.x and 5.x in ExpressPlugin#125thiagomatar wants to merge 3 commits intoapache:masterfrom
thiagomatar wants to merge 3 commits intoapache:masterfrom
Conversation
thiagomatar
commented
Feb 14, 2025
Contributor
Author
thiagomatar
left a comment
There was a problem hiding this comment.
simplifying the solution
Contributor
Author
|
sorry guys I did a mistake and I will open other PR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We are evaluating the use of SkyWalking in our company, and I have started some proof-of-concept tests to evaluate the agents.
I created a new project using Node.js/NestJS and the SkyWalking Node.js agent, following the instructions provided on the NodeJS Agent page to install it in the project.
Versions used:
Upon initializing the project, I encountered the following error message:
{ message: 'Error installing plugin express *', level: 'error', file: '...node_modules/skywalking-backend-js/lib/core/PluginInstaller.js' }After investigating the code, I identified the root cause.
In the ExpressPlugin.js file, line 39:
The error
Cannot find module 'express/lib/router'occurs because the installed version of Express no longer has this folder structure (express/lib/router). This is due to recent versions of Express reorganizing their modules differently.To address this issue, I am adding compatibility for both older and newer versions of Express:
express.Router()(used in Express 5+).express/lib/router(used in Express 4.x).