如何在Windows 7上使用npm安装v8-profiler?

试图在Windows7(64位)上安装v8-profiler

npm install v8-profiler 

注意:1.依赖是Python 2.7,我已经安装并设置了env。 变种。 也

  1. 已确认“Visual C ++可再发行组件包”已安装。

  2. node-gyp模块也被安装

但是仍然抛出的错误如下:

 D:\Projects\Projects\MY_Prjct3\MY_Prjct>npm install v8-profiler 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 D:\Projects\Projects\MY_Prjct3\MY_Prjct\node_modules\ v8-profiler > node-gyp rebuild D:\Projects\Projects\MY_Prjct3\MY_Prjct\node_modules\v8-profiler>node "C:\Program F iles\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\n ode-gyp.js" rebuild C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.Cpp.InvalidPlatform .Targets(23,7): error MSB8007: The Platform for project 'profiler.vcxproj' is i nvalid. Platform='x64'. You may be seeing this message because you are trying to build a project without a solution file, and have specified a non-default Pl atform that doesn't exist for this project. [D:\Projects\Projects\MY_Prjct3\My_Prj ct\node_modules\v8-profiler\build\profiler.vcxproj] 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:236:23) gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:99:17) gyp ERR! stack at Process._handle.onexit (child_process.js:678:10) gyp ERR! System Windows_NT 6.1.7601 gyp ERR! command "node" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modu les\\node-gyp\\bin\\node-gyp.js" "rebuild" gyp ERR! cwd D:\Projects\Projects\MY_Prjct3\MY_Prjct\node_modules\v8-profiler gyp ERR! node -v v0.8.15 gyp ERR! node-gyp -v v0.7.1 gyp ERR! not ok npm ERR! v8-profiler@3.6.2-1 install: `node-gyp rebuild` npm ERR! `cmd "/c" "node-gyp rebuild"` failed with 1 npm ERR! npm ERR! Failed at the v8-profiler@3.6.2-1 install script. npm ERR! This is most likely a problem with the v8-profiler 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 their info via: npm ERR! npm owner ls v8-profiler npm ERR! There is likely additional logging output above. npm ERR! System Windows_NT 6.1.7601 npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nod ejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "v8-profiler" npm ERR! cwd D:\Projects\Projects\MY_Prjct3\MY_Prjct npm ERR! node -v v0.8.15 npm ERR! npm -v 1.1.66 npm ERR! code ELIFECYCLE npm ERR! npm ERR! Additional logging details can be found in: npm ERR! D:\Projects\Projects\MY_Prjct3\MY_Prjct\npm-debug.log npm ERR! not ok code 0 

文件:npm-debug.log

 0 info it worked if it ends with ok 1 verbose cli [ 'C:\\Program Files\\nodejs\\\\node.exe', 1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js', 1 verbose cli 'install', 1 verbose cli 'v8-profiler' ] 2 info using npm@1.1.66 3 info using node@v0.8.15 4 verbose node symlink C:\Program Files\nodejs\\node.exe 5 verbose read json D:\Projects\Projects\MY_Prjct3\MY_Prjct3\package.json 6 verbose read json D:\Projects\Projects\MY_Prjct3\MY_Prjct3\node_modules\express\package.json 7 verbose read json D:\Projects\Projects\MY_Prjct3\MY_Prjct3\node_modules\hbs\package.json 8 verbose read json D:\Projects\Projects\MY_Prjct3\MY_Prjct3\node_modules\mongodb\package.json 9 verbose read json D:\Projects\Projects\MY_Prjct3\MY_Prjct3\node_modules\mongoose\package.json 10 verbose read json D:\Projects\Projects\MY_Prjct3\MY_Prjct3\node_modules\node-inspector\package.json 11 verbose read json D:\Projects\Projects\MY_Prjct3\MY_Prjct3\package.json 12 verbose cache add [ 'v8-profiler', null ] 13 silly cache add name=undefined spec="v8-profiler" args=["v8-profiler",null] 14 verbose parsed url { pathname: 'v8-profiler', 14 verbose parsed url path: 'v8-profiler', 14 verbose parsed url href: 'v8-profiler' } 15 silly lockFile a12f389f-v8-profiler v8-profiler 16 verbose lock v8-profiler C:\Users\Amol.Kulkarni\AppData\Roaming\npm-cache\a12f389f-v8-profiler.lock 17 silly lockFile a12f389f-v8-profiler v8-profiler 18 verbose addNamed [ 'v8-profiler', '' ] 19 verbose addNamed [ null, '' ] 20 silly lockFile f875d38f-v8-profiler v8-profiler@ 21 verbose lock v8-profiler@ C:\Users\Amol.Kulkarni\AppData\Roaming\npm-cache\f875d38f-v8-profiler.lock 22 silly addNameRange { name: 'v8-profiler', range: '', hasData: false } 23 verbose url raw v8-profiler 24 verbose url resolving [ 'https://registry.npmjs.org/', './v8-profiler' ] 25 verbose url resolved https://registry.npmjs.org/v8-profiler 26 info trying registry request attempt 1 at 16:54:05 27 verbose etag "ET10KXXLUBJGCCEB13YK5N04L" 28 http GET https://registry.npmjs.org/v8-profiler 29 http 304 https://registry.npmjs.org/v8-profiler 30 silly registry.get cb [ 304, 30 silly registry.get { server: 'CouchDB/1.2.0 (Erlang OTP/R15B)', 30 silly registry.get etag: '"ET10KXXLUBJGCCEB13YK5N04L"', 30 silly registry.get date: 'Tue, 08 Jan 2013 11:21:56 GMT', 30 silly registry.get 'content-length': '0' } ] 31 verbose etag v8-profiler from cache 32 silly addNameRange number 2 { name: 'v8-profiler', range: '', hasData: true } 33 silly addNameRange versions [ 'v8-profiler', 33 silly addNameRange [ '0.0.1', '0.0.2', '0.0.3', '3.6.2beta', '3.6.2beta2', '3.6.2-1' ] ] 34 verbose addNamed [ 'v8-profiler', '3.6.2-1' ] 35 verbose addNamed [ '3.6.2-1', '3.6.2-1' ] 36 silly lockFile 19e1a1b9-v8-profiler-3-6-2-1 v8-profiler@3.6.2-1 37 verbose lock v8-profiler@3.6.2-1 C:\Users\Amol.Kulkarni\AppData\Roaming\npm-cache\19e1a1b9-v8-profiler-3-6-2-1.lock 38 verbose read json C:\Users\Amol.Kulkarni\AppData\Roaming\npm-cache\v8-profiler\3.6.2-1\package\package.json 39 silly lockFile 19e1a1b9-v8-profiler-3-6-2-1 v8-profiler@3.6.2-1 40 silly lockFile f875d38f-v8-profiler v8-profiler@ 41 silly resolved [ { name: 'v8-profiler', 41 silly resolved version: '3.6.2-1', 41 silly resolved description: 'node bindings for the v8 profiler', 41 silly resolved homepage: 'http://github.com/dannycoates/v8-profiler', 41 silly resolved author: { name: 'Danny Coates', email: 'dannycoates@gmail.com' }, 41 silly resolved keywords: [ 'profiler', 'inspector' ], 41 silly resolved engines: { node: '>=0.6' }, 41 silly resolved main: 'v8-profiler', 41 silly resolved scripts: { install: 'node-gyp rebuild' }, 41 silly resolved gypfile: true, 41 silly resolved readme: 'v8-profiler provides [node](http://github.com/ry/node) bindings for the v8 \nprofiler and integration with [node-inspector](http://github.com/dannycoates/node-inspector)\n\n## Installation\n\n npm install v8-profiler\n\n## Usage\n\n var profiler = require(\'v8-profiler\');\n\n## API\n\n var snapshot = profiler.takeSnapshot([name]) //takes a heap snapshot\n\n profiler.startProfiling([name]) //begin cpu profiling\n var cpuProfile = profiler.stopProfiling([name]) //finish cpu profiling\n\n## node-inspector\n\nCpu profiles can be viewed and heap snapshots may be taken and viewed from the\nprofiles panel.\n', 41 silly resolved readmeFilename: 'readme.md', 41 silly resolved _id: 'v8-profiler@3.6.2-1', 41 silly resolved _from: 'v8-profiler' } ] 42 info install v8-profiler@3.6.2-1 into D:\Projects\Projects\MY_Prjct3\MY_Prjct3 43 info installOne v8-profiler@3.6.2-1 44 verbose from cache C:\Users\Amol.Kulkarni\AppData\Roaming\npm-cache\v8-profiler\3.6.2-1\package\package.json 45 info D:\Projects\Projects\MY_Prjct3\MY_Prjct3\node_modules\v8-profiler unbuild 46 verbose read json D:\Projects\Projects\MY_Prjct3\MY_Prjct3\node_modules\v8-profiler\package.json 47 verbose tar unpack C:\Users\Amol.Kulkarni\AppData\Roaming\npm-cache\v8-profiler\3.6.2-1\package.tgz 48 silly lockFile cffa88b0-ce3-MY_Prjct3-node-modules-v8-profiler D:\Projects\Projects\MY_Prjct3\MY_Prjct3\node_modules\v8-profiler 49 verbose lock D:\Projects\Projects\MY_Prjct3\MY_Prjct3\node_modules\v8-profiler C:\Users\Amol.Kulkarni\AppData\Roaming\npm-cache\cffa88b0-ce3-MY_Prjct3-node-modules-v8-profiler.lock 50 silly gunzTarPerm modes [ '755', '644' ] 51 silly gunzTarPerm extractEntry package.json 52 silly gunzTarPerm modified mode [ 'package.json', 438, 420 ] 53 silly gunzTarPerm extractEntry .npmignore 54 silly gunzTarPerm modified mode [ '.npmignore', 438, 420 ] 55 silly gunzTarPerm extractEntry v8-profiler.js 56 silly gunzTarPerm modified mode [ 'v8-profiler.js', 438, 420 ] 57 silly gunzTarPerm extractEntry profile.cc 58 silly gunzTarPerm modified mode [ 'profile.cc', 438, 420 ] 59 silly gunzTarPerm extractEntry graph_edge.cc 60 silly gunzTarPerm modified mode [ 'graph_edge.cc', 438, 420 ] 61 silly gunzTarPerm extractEntry graph_edge.h 62 silly gunzTarPerm modified mode [ 'graph_edge.h', 438, 420 ] 63 silly gunzTarPerm extractEntry graph_node.cc 64 silly gunzTarPerm modified mode [ 'graph_node.cc', 438, 420 ] 65 silly gunzTarPerm extractEntry graph_node.h 66 silly gunzTarPerm modified mode [ 'graph_node.h', 438, 420 ] 67 silly gunzTarPerm extractEntry heap_profiler.cc 68 silly gunzTarPerm modified mode [ 'heap_profiler.cc', 438, 420 ] 69 silly gunzTarPerm extractEntry heap_profiler.h 70 silly gunzTarPerm modified mode [ 'heap_profiler.h', 438, 420 ] 71 silly gunzTarPerm extractEntry Makefile 72 silly gunzTarPerm modified mode [ 'Makefile', 438, 420 ] 73 silly gunzTarPerm extractEntry binding.gyp 74 silly gunzTarPerm modified mode [ 'binding.gyp', 438, 420 ] 75 silly gunzTarPerm extractEntry cpu_profiler.h 76 silly gunzTarPerm modified mode [ 'cpu_profiler.h', 438, 420 ] 77 silly gunzTarPerm extractEntry profile.h 78 silly gunzTarPerm modified mode [ 'profile.h', 438, 420 ] 79 silly gunzTarPerm extractEntry profiler.cc 80 silly gunzTarPerm modified mode [ 'profiler.cc', 438, 420 ] 81 silly gunzTarPerm extractEntry profile_node.cc 82 silly gunzTarPerm modified mode [ 'profile_node.cc', 438, 420 ] 83 silly gunzTarPerm extractEntry profile_node.h 84 silly gunzTarPerm modified mode [ 'profile_node.h', 438, 420 ] 85 silly gunzTarPerm extractEntry readme.md 86 silly gunzTarPerm modified mode [ 'readme.md', 438, 420 ] 87 silly gunzTarPerm extractEntry snapshot.cc 88 silly gunzTarPerm modified mode [ 'snapshot.cc', 438, 420 ] 89 silly gunzTarPerm extractEntry snapshot.h 90 silly gunzTarPerm modified mode [ 'snapshot.h', 438, 420 ] 91 silly gunzTarPerm extractEntry cpu_profiler.cc 92 silly gunzTarPerm modified mode [ 'cpu_profiler.cc', 438, 420 ] 93 silly gunzTarPerm extractEntry wscript 94 silly gunzTarPerm modified mode [ 'wscript', 438, 420 ] 95 verbose read json D:\Projects\Projects\MY_Prjct3\MY_Prjct3\node_modules\v8-profiler\package.json 96 silly lockFile cffa88b0-ce3-MY_Prjct3-node-modules-v8-profiler D:\Projects\Projects\MY_Prjct3\MY_Prjct3\node_modules\v8-profiler 97 info preinstall v8-profiler@3.6.2-1 98 verbose from cache D:\Projects\Projects\MY_Prjct3\MY_Prjct3\node_modules\v8-profiler\package.json 99 verbose readDependencies using package.json deps 100 verbose from cache D:\Projects\Projects\MY_Prjct3\MY_Prjct3\node_modules\v8-profiler\package.json 101 verbose readDependencies using package.json deps 102 silly resolved [] 103 verbose about to build D:\Projects\Projects\MY_Prjct3\MY_Prjct3\node_modules\v8-profiler 104 info build D:\Projects\Projects\MY_Prjct3\MY_Prjct3\node_modules\v8-profiler 105 verbose from cache D:\Projects\Projects\MY_Prjct3\MY_Prjct3\node_modules\v8-profiler\package.json 106 verbose linkStuff [ false, 106 verbose linkStuff false, 106 verbose linkStuff false, 106 verbose linkStuff 'D:\\Projects\\Projects\\MY_Prjct3\\MY_Prjct3\\node_modules' ] 107 info linkStuff v8-profiler@3.6.2-1 108 verbose linkBins v8-profiler@3.6.2-1 109 verbose linkMans v8-profiler@3.6.2-1 110 verbose rebuildBundles v8-profiler@3.6.2-1 111 info install v8-profiler@3.6.2-1 112 verbose unsafe-perm in lifecycle true 113 silly exec cmd "/c" "node-gyp rebuild" 114 silly cmd,/c,node-gyp rebuild,D:\Projects\Projects\MY_Prjct3\MY_Prjct3\node_modules\v8-profiler spawning 115 info v8-profiler@3.6.2-1 Failed to exec install script 116 info D:\Projects\Projects\MY_Prjct3\MY_Prjct3\node_modules\v8-profiler unbuild 117 verbose from cache D:\Projects\Projects\MY_Prjct3\MY_Prjct3\node_modules\v8-profiler\package.json 118 info preuninstall v8-profiler@3.6.2-1 119 info uninstall v8-profiler@3.6.2-1 120 verbose true,D:\Projects\Projects\MY_Prjct3\MY_Prjct3\node_modules,D:\Projects\Projects\MY_Prjct3\MY_Prjct3\node_modules unbuild v8-profiler@3.6.2-1 121 info postuninstall v8-profiler@3.6.2-1 122 error v8-profiler@3.6.2-1 install: `node-gyp rebuild` 122 error `cmd "/c" "node-gyp rebuild"` failed with 1 123 error Failed at the v8-profiler@3.6.2-1 install script. 123 error This is most likely a problem with the v8-profiler package, 123 error not with npm itself. 123 error Tell the author that this fails on your system: 123 error node-gyp rebuild 123 error You can get their info via: 123 error npm owner ls v8-profiler 123 error There is likely additional logging output above. 124 error System Windows_NT 6.1.7601 125 error command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "v8-profiler" 126 error cwd D:\Projects\Projects\MY_Prjct3\MY_Prjct3 127 error node -v v0.8.15 128 error npm -v 1.1.66 129 error code ELIFECYCLE 130 verbose exit [ 1, true ] 

       

网上收集的解决方案 "如何在Windows 7上使用npm安装v8-profiler?"

您的C ++编译器(来自Microsoft Visual Studio 2010)是一个32位编译器,但是您正尝试构build一个64位程序。

安装并切换到64位C ++编译器,或切换到32位版本的node / npm。

V8-profiler(“version”:“0.0.2”)使用了一些V8 API,但这些API在版本3.11.5中从V8中删除。 node.js在版本0.7.11中将v8版本从3.9.24.31升级到3.11.10,因此所有晚于0.7.11的版本都无法运行。

欲了解更多信息:

https://github.com/dannycoates/v8-profiler/issues/20

https://github.com/dannycoates/v8-profiler/issues/16#issuecomment-9099768