在 npm 安装期间使用 heapdump 出现以下错误

问题描述 投票:0回答:3

使用 NodeJS 安装 heapdump 时,我遇到以下错误消息。我也在系统上安装了python。我必须在node_module中安装heapdump包。 下面是 package.json 的部分,我在其中指定了 heapdump 版本。 "grunt-shell": "^0.6.4", “堆转储”:“^0.3.4”

error:
[06:26:28][Step 4/8] npm http 304 https://registry.npmjs.org/getobject

[06:26:28][Step 4/8] npm ERR! [email protected] install: `node-gyp rebuild`

[06:26:28][Step 4/8] npm ERR! Exit status 1

[06:26:28][Step 4/8] npm ERR! 

[06:26:28][Step 4/8] npm ERR! Failed at the [email protected] install script.

[06:26:28][Step 4/8] npm ERR! This is most likely a problem with the heapdump package,

[06:26:28][Step 4/8] npm ERR! not with npm itself.

[06:26:28][Step 4/8] npm ERR! Tell the author that this fails on your system:

[06:26:28][Step 4/8] npm ERR!     node-gyp rebuild

[06:26:28][Step 4/8] npm ERR! You can get their info via:

[06:26:28][Step 4/8] npm ERR!     npm owner ls heapdump

[06:26:28][Step 4/8] npm ERR! There is likely additional logging output above.

[06:26:28][Step 4/8] 

[06:26:28][Step 4/8] npm ERR! System Windows_NT 6.1.7601

[06:26:28][Step 4/8] npm ERR! command "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"

[06:26:28][Step 4/8] npm ERR! cwd C:\TeamCity\buildAgent\work\60663b0f150483a8\smoke

[06:26:29][Step 4/8] npm ERR! node -v v0.10.22

[06:26:29][Step 4/8] npm ERR! npm -v 1.3.14

[06:26:29][Step 4/8] npm ERR! code ELIFECYCLE
t
heap-dump
3个回答
0
投票

您没有在问题中指定操作系统,但错误跟踪显示 Windows_NT 6.1.7601。

其失败的原因可能不止一个。

node-gyp 是一个用 Node.js 编写的跨平台命令行工具,用于为 Node.js 编译本机插件模块。因此,当您尝试安装 heapdump 时,它在内部使用“node-gyp”为您的特定平台(windows/unix/mac 等)重建模块。 一个可能的原因是使用的 python 版本。推荐Python v2.7,不支持v3.x.x。如果是这种情况,您将收到如下错误。

gyp ERR! configure error
gyp ERR! stack Error: Python executable "python" is v3.5.1, which is not supported by gyp.
gyp ERR! stack You can pass the --python switch to point to Python >= v2.5.0 & < 3.0.0.

要解决此问题,您可以使用 npm install python 开关,如下所示。

npm install --python=python2.7

其他失败原因与操作系统有关。如果您要在 Windows 上安装此程序,您应该拥有 Microsoft Visual Studio C++ 2013(XP/7/8 等)或 Visual Studio Community 2015 Edition(Windows 10)。 阅读此链接了解更多信息


0
投票

我在安装heapdump@^0.3.12包时遇到了同样的问题,npm使用node gyb来重建包。我改变了 python 版本,安装了 Visual bla bla....但它不起作用。然后我使用另一个带有另一个 npm 和 node 版本的设备,它工作了。 我认为问题的原因是node和npm版本。我升级了它们,然后它在我的设备上运行了。 之前:节点:10.15.3 之后:节点:14.16.1 npm: 6.9.2 npm: 6.14.12 这里有一个推荐。最新版本可能无法帮助您,让我们尝试一些接近的版本。


0
投票

请检查节点版本是否正确并尝试重新安装node_modules。

© www.soinside.com 2019 - 2024. All rights reserved.