问题描述
我正在尝试安装heapdump,以便我可以学习查找Node.js应用程序中的内存泄漏。我在笔记本电脑上使用Xubuntu 20.04。当我使用npm version
时会得到
ares: '1.10.1-DEV',http_parser: '2.5.2',icu: '56.1',modules: '46',node: '4.4.7',openssl: '1.0.2h',uv: '1.8.0',v8: '4.5.103.36',zlib: '1.2.8' }
当我尝试安装heapdump时,我一直遇到此错误。我对Node.js不太熟悉,这使这一工作变得更加困难,但是我确实需要解决这个问题。
ben@bens-omen:~$ npm i heapdump
-
> heapdump@0.3.15 install /home/ben/node_modules/heapdump
> node-gyp 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 failnopython (/home/ben/.nvm/versions/node/v4.4.7/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:401:14)
gyp ERR! stack at /home/ben/.nvm/versions/node/v4.4.7/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:330:11
gyp ERR! stack at F (/home/ben/.nvm/versions/node/v4.4.7/lib/node_modules/npm/node_modules/which/which.js:69:16)
gyp ERR! stack at E (/home/ben/.nvm/versions/node/v4.4.7/lib/node_modules/npm/node_modules/which/which.js:81:29)
gyp ERR! stack at /home/ben/.nvm/versions/node/v4.4.7/lib/node_modules/npm/node_modules/which/which.js:90:16
gyp ERR! stack at /home/ben/.nvm/versions/node/v4.4.7/lib/node_modules/npm/node_modules/which/node_modules/isexe/index.js:44:5
gyp ERR! stack at /home/ben/.nvm/versions/node/v4.4.7/lib/node_modules/npm/node_modules/which/node_modules/isexe/access.js:8:5
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:82:15)
gyp ERR! System Linux 5.4.0-52-generic
gyp ERR! command "/home/ben/.nvm/versions/node/v4.4.7/bin/node" "/home/ben/.nvm/versions/node/v4.4.7/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/ben/node_modules/heapdump
gyp ERR! node -v v4.4.7
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok
npm ERR! Linux 5.4.0-52-generic
npm ERR! argv "/home/ben/.nvm/versions/node/v4.4.7/bin/node" "/home/ben/.nvm/versions/node/v4.4.7/bin/npm" "i" "heapdump"
npm ERR! node v4.4.7
npm ERR! npm v2.15.8
npm ERR! code ELIFECYCLE
npm ERR! heapdump@0.3.15 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the heapdump@0.3.15 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the heapdump package,npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs heapdump
npm ERR! Or if that isn't available,you can get their info via:
npm ERR!
npm ERR! npm owner ls heapdump
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/ben/npm-debug.log
我仍然是一个相当新手的Linux用户,所以我在这里有点不熟悉。我花了最后几个小时试图找到解决方案,但似乎没有任何效果。我是否缺少依赖项?
在此先感谢您的帮助。
解决方法
我不仅是Linux的新手,还是SO的新手。我了解在这里发布/删除问题有非常严格的规则。我找到了答案,并相信在此处发布答案>删除问题。
经过几个小时的寻找答案,我发现它就像安装gyp一样简单(我只是尝试使用错误的命令来尝试这样做)
安装gyp的命令为sudo apt install node-gyp