microsoft / ApplicationInsights-node.js

Microsoft Application Insights SDK for Node.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dependency incompatible with node < 18

Agritite opened this issue · comments

Trying yarn add applicationinsights on node 14.21.3, and got

error @azure/core-auth@1.6.0: The engine "node" is incompatible with this module. Expected version ">=18.0.0". Got "14.21.3"

So I tried to resolve all incompatibilities by manually writing all dependency resolutions in package.json, and I'm stuck here:

"resolutions": {
    "applicationinsights/@azure/core-auth": "1.5.0",
    "applicationinsights/@azure/core-util": "1.2.0"
},

With these 2, now yarn add applicationinsights emits:

error @azure/core-util@1.7.0: The engine "node" is incompatible with this module. Expected version ">=18.0.0". Got "14.21.3"

which means now it's a 2nd generation dependency having compatibility issues, and I have absolutely no idea which. Also, what if there are 10 more of these incompatibilities? I find it highly impractical, so I gave up. Any ideas?

Edit:
I didn't know you can have wildcard resolutions. This works:

"resolutions": {
    "@azure/core-auth": "1.5.0",
    "@azure/core-util": "1.2.0"
},

Still, I feel like this is more of a workaround, because if README claims ApplicationInsights supports node 8 then it should work out of the box.

It's good to know, except for having to inject that into every node project.

@azure/core-auth claims that this is policy:

The Azure SDK libraries for JavaScript will not be guaranteed to work on Node.js versions that have reached their end of life. Dropping support for such Node.js versions may be done without increasing the major version of the Azure SDK libraries.

Which seems wierd because if this was policy from the beginning, then the Node Compatibility section shouldn't even be included in the README because it could be invalidated at anytime even if this package hasn't bumped its version at all, such as now.