Does APM for NodeJS require Python? (gyp ERR)

ELK 6.5 Windows, APM Server 6.6.1

Just wanted to try out APM in a small NodeJS app and was surprised to find it asking for python. This is not listed as a dependency nor a requirement when installing APM so I was wondering: Does APM require Python on the client and if so why??

C:\xyz\Work\JavaScript\express-test>npm install elastic-apm-node --save

> dtrace-provider@0.8.7 install C:\xyz\Work\JavaScript\express-test\node_modules\dtrace-provider
> node-gyp rebuild || node suppress-error.js

C:\xyz\Work\JavaScript\express-test\node_modules\dtrace-provider>if not defined npm_config_node_gyp (node "C:\Users\z22\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Users\z22\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (C:\Users\z22\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\configure.js:484:19)
gyp ERR! stack     at PythonFinder.<anonymous> (C:\Users\z22\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\configure.js:509:16)
gyp ERR! stack     at C:\Users\z22\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:154:21)
gyp ERR! System Windows_NT 10.0.16299
gyp ERR! command "C:\\prg\\nodejs\\node.exe" "C:\\Users\\z22\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\xyz\Work\JavaScript\express-test\node_modules\dtrace-provider
gyp ERR! node -v v10.15.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN mytest@1.0.0 No description
npm WARN mytest@1.0.0 No repository field.

Sorry for the trouble having Python as a dependency shouldn't be a requirement. I just took a quick look at this and can see this wasn't intentional.

The dtrace-provider module is a sub-dependency of one of our other dependencies. But normally it ships with pre-built binaries, which it seems doesn't match your system. That's why it's trying to recompile which is done using a Python script.

That being said, this can potentially be a brittle install process, which you just discovered. I'll make sure we look into changing this dependency somehow so it's no longer included.

The dependency in question is used for metrics reporting. As a temporary workaround, you can downgrade to version 2.4.0 of the Node.js agent which doesn't include metrics support and therefore doesn't have this dependency. Simply pin your dependency on the agent to 2.4.0 and run npm install again.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Just wanted to follow up and say that we released version 2.7.0 a few weeks ago which fixes the install issue on Windows. There's no longer any need to compile any native code. So feel free to upgrade again :smiley:

Sorry for the trouble.