如何使用npm在Windows 8(64位)上安装v8-profiler?

v8-profiler是跟踪node.js应用程序内存泄漏的“标准”。

当我尝试使用npm install v8-profiler进行安装时,我收到一条错误消息,似乎是在抱怨32位和64位编译。

 C:\Users\fmcdowall\Desktop\node\norch>npm install v8-profiler npm WARN package.json norch@0.2.1 No repository field. npm WARN package.json search-index@0.2.8 No repository field. npm http GET https://registry.npmjs.org/v8-profiler npm http 304 https://registry.npmjs.org/v8-profiler > v8-profiler@3.6.2-1 install C:\Users\fmcdowall\Desktop\node\norch\node_modules \v8-profiler > node-gyp rebuild C:\Users\fmcdowall\Desktop\node\norch\node_modules\v8-profiler>node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\ node-gyp.js" rebuild Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch. profile_node.cc heap_profiler.cc cpu_profiler.cc graph_edge.cc snapshot.cc graph_node.cc ..\graph_node.cc(76): warning C4244: 'argument' : conversion from 'uint64_t' to 'uint32_t', possible loss of data [C:\Users\fmcdowall\Desktop\node\norch\node_ modules\v8-profiler\build\profiler.vcxproj] ..\graph_node.cc(84): warning C4244: 'argument' : conversion from 'uint64_t' to 'uint32_t', possible loss of data [C:\Users\fmcdowall\Desktop\node\norch\node_ modules\v8-profiler\build\profiler.vcxproj] ..\graph_node.cc(99): error C2039: 'GetRetainersCount' : is not a member of 'v8 ::HeapGraphNode' [C:\Users\fmcdowall\Desktop\node\norch\node_modules\v8-profile r\build\profiler.vcxproj] C:\Users\fmcdowall\.node-gyp\0.10.15\deps\v8\include\v8-profiler.h(24 9) : see declaration of 'v8::HeapGraphNode' ..\graph_node.cc(132): error C2039: 'GetRetainedSize' : is not a member of 'v8: :HeapGraphNode' [C:\Users\fmcdowall\Desktop\node\norch\node_modules\v8-profiler \build\profiler.vcxproj] C:\Users\fmcdowall\.node-gyp\0.10.15\deps\v8\include\v8-profiler.h(24 9) : see declaration of 'v8::HeapGraphNode' ..\graph_node.cc(154): error C2039: 'GetRetainer' : is not a member of 'v8::Hea pGraphNode' [C:\Users\fmcdowall\Desktop\node\norch\node_modules\v8-profiler\bui ld\profiler.vcxproj] C:\Users\fmcdowall\.node-gyp\0.10.15\deps\v8\include\v8-profiler.h(24 9) : see declaration of 'v8::HeapGraphNode' ..\graph_node.cc(162): error C2039: 'GetDominatorNode' : is not a member of 'v8 ::HeapGraphNode' [C:\Users\fmcdowall\Desktop\node\norch\node_modules\v8-profile r\build\profiler.vcxproj] C:\Users\fmcdowall\.node-gyp\0.10.15\deps\v8\include\v8-profiler.h(24 9) : see declaration of 'v8::HeapGraphNode' profiler.cc C:\Users\fmcdowall\.node-gyp\0.10.15\deps\v8\include\v8.h(184): warning C4506: no definition for inline function 'v8::Persistent<T> v8::Persistent<T>::New(v8: :Handle<T>)' [C:\Users\fmcdowall\Desktop\node\norch\node_modules\v8-profiler\bu ild\profiler.vcxproj] with [ T=v8::Object ] (..\cpu_profiler.cc) C:\Users\fmcdowall\.node-gyp\0.10.15\deps\v8\include\v8.h(184): warning C4506: no definition for inline function 'v8::Persistent<T> v8::Persistent<T>::New(v8: :Handle<T>)' [C:\Users\fmcdowall\Desktop\node\norch\node_modules\v8-profiler\bu ild\profiler.vcxproj] with [ T=v8::Object ] (..\heap_profiler.cc) profile.cc ..\snapshot.cc(90): warning C4244: 'argument' : conversion from 'uint64_t' to ' v8::SnapshotObjectId', possible loss of data [C:\Users\fmcdowall\Desktop\node\n orch\node_modules\v8-profiler\build\profiler.vcxproj] C:\Users\fmcdowall\.node-gyp\0.10.15\deps\v8\include\v8.h(184): warning C4506: no definition for inline function 'v8::Persistent<T> v8::Persistent<T>::New(v8: :Handle<T>)' [C:\Users\fmcdowall\Desktop\node\norch\node_modules\v8-profiler\bu ild\profiler.vcxproj] with [ T=v8::Object ] (..\snapshot.cc) C:\Users\fmcdowall\.node-gyp\0.10.15\deps\v8\include\v8.h(179): warning C4506: no definition for inline function 'v8::Persistent<T> v8::Persistent<T>::New(v8: :Handle<T>)' [C:\Users\fmcdowall\Desktop\node\norch\node_modules\v8-profiler\bu ild\profiler.vcxproj] with [ T=v8::Object ] (..\profiler.cc) gyp ERR! build error gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe ` failed with exit code: 1 gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\ npm\node_modules\node-gyp\lib\build.js:267:23) gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17) gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:789: 12) gyp ERR! System Windows_NT 6.2.9200 gyp ERR! command "node" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modu les\\node-gyp\\bin\\node-gyp.js" "rebuild" gyp ERR! cwd C:\Users\fmcdowall\Desktop\node\norch\node_modules\v8-profiler gyp ERR! node -v v0.10.15 gyp ERR! node-gyp -v v0.10.6 gyp ERR! not ok npm ERR! weird error 1 npm ERR! not ok code 0 

在Windows 8上如何安装v8-profiler模块?

在我的情况下,这不是关于x64。 原因是这个插件是为旧节点devise的(比如0.3),它打破了0.10。 你需要看看模块的叉子,看看修复。 这一个似乎是最正确的,由节点督察家伙支持

https://github.com/nodefly/nodefly-v8-profiler

我试过这个删除堆分析器,这实际上是破碎的

 npm install git://github.com/tonistiigi/v8-profiler.git#remove-heap-profiler