在npm安装期间,堆转储面临错误

时间:2015-02-20 17:20:39

标签: heap-dump

使用nodejs安装heapdump我面临下面的错误消息。我也在系统上安装了python。我必须在node_module中安装heapdump包。 下面是package.json的一部分,我已经指定了heapdump版本。         " grunt-shell":" ^ 0.6.4",         " heapdump":" ^ 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! heapdump@0.3.5 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 heapdump@0.3.5 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

2 个答案:

答案 0 :(得分: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

失败的其他原因是OS特有的。如果要在Windows上安装它,则应具有Microsoft Visual Studio C ++ 2013(XP / 7/8等)或Visual Studio Community 2015 Edition(Windows 10)。 阅读this link了解更多

答案 1 :(得分: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 这里有一个推荐。最新版本可能帮不了你,让我们试试一些接近的版本。