You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by "thiagomatar (via GitHub)" <gi...@apache.org> on 2025/02/14 18:34:55 UTC
[PR] Fix: Express plugin compatibility for Express 4.x and 5.x [skywalking-nodejs]
thiagomatar opened a new pull request, #126:
URL: https://github.com/apache/skywalking-nodejs/pull/126
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](https://github.com/thiagomatar/skywalking-nodejs) to install it in the project.
**Versions used:**
- Node.js: 22.14.0
- NestJS: 11.0.1
- Express: 5.0.1
Upon initializing the project, I encountered the following error message:
```json
{
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](https://github.com/apache/skywalking-nodejs/blob/master/src/plugins/ExpressPlugin.ts) file, line 39:
```javascript
var router = (_b = (_a = installer.require) === null || _a === void 0 ? void 0 : _a.call(installer, 'express/lib/router')) !== null && _b !== void 0 ? _b : require('express/lib/router');
```
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:
1. First, attempt to load `express.Router()` (used in Express 5+).
2. If that fails, attempt to load `express/lib/router` (used in Express 4.x).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix: Express plugin compatibility for Express 4.x and 5.x [skywalking-nodejs]
Posted by "wu-sheng (via GitHub)" <gi...@apache.org>.
wu-sheng commented on PR #126:
URL: https://github.com/apache/skywalking-nodejs/pull/126#issuecomment-2660761095
And CI should pass, you should have verified the codes through all CI processes locally.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix: Express plugin compatibility for Express 4.x and 5.x [skywalking-nodejs]
Posted by "wu-sheng (via GitHub)" <gi...@apache.org>.
wu-sheng commented on PR #126:
URL: https://github.com/apache/skywalking-nodejs/pull/126#issuecomment-2660760872
I'm not working on nodejs agent, need to wait for @kezhenxu94 to review.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix: Express plugin compatibility for Express 4.x and 5.x [skywalking-nodejs]
Posted by "thiagomatar (via GitHub)" <gi...@apache.org>.
thiagomatar commented on PR #126:
URL: https://github.com/apache/skywalking-nodejs/pull/126#issuecomment-2660443073
@wu-sheng Can you check this other one please?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix: Express plugin compatibility for Express 4.x and 5.x [skywalking-nodejs]
Posted by "thiagomatar (via GitHub)" <gi...@apache.org>.
thiagomatar commented on PR #126:
URL: https://github.com/apache/skywalking-nodejs/pull/126#issuecomment-2665955724
Thanks for the reply, I am facing errors while trying to install node 14 on my macbook, there are some issues with the m1 cpus architecture. I will try run the tests in other computer later.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix: Express plugin compatibility for Express 4.x and 5.x [skywalking-nodejs]
Posted by "thiagomatar (via GitHub)" <gi...@apache.org>.
thiagomatar commented on PR #126:
URL: https://github.com/apache/skywalking-nodejs/pull/126#issuecomment-2660021017
Sorry guys, I had to close the other PR because I did something wrong.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix: Express plugin compatibility for Express 4.x and 5.x [skywalking-nodejs]
Posted by "kezhenxu94 (via GitHub)" <gi...@apache.org>.
kezhenxu94 merged PR #126:
URL: https://github.com/apache/skywalking-nodejs/pull/126
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org