Visual Studio Online中的npm安装失败

我有一个Web应用程序与前端构build与Angular和后端与MVC,WebApi构build。 我正在Visual Studio Online上创build一个CI环境。 现在,npm安装和运行grunt任务由.cmd文件处理,并包含在Visual Studio Web项目的生成过程中。

当我在VSO中添加构build步骤时,我将构build步骤分离到了NuGet安装,解决scheme构build,npm安装,grunt任务运行等(我已经从项目中删除了.cmd文件的执行)。

但是,当npm安装步骤正在发生,它会失败,并出现以下错误。

****************************************************************************** Starting task: npm install ****************************************************************************** Executing the powershell script: C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\tasks\NpmInstall\0.1.3\NpmInstall.ps1 C:\Program Files\nodejs\npm.cmd install npm WARN package.json grunt-XXXXXXX-Identity@0.1.0 No description npm WARN package.json grunt-XXXXXXX-Identity@0.1.0 No README data npm WARN package.json grunt-XXXXXXX-Identity@0.1.0 No license field. npm WARN peerDependencies The peer dependency tslint@^2.0.1 included from grunt-tslint will no npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly. npm WARN optional dep failed, continuing fsevents@1.0.0 > v8-profiler@5.2.12 preinstall C:\a\02e68ad0\XXXX XXXXXX\Source\XXXXXXX.Identity\XXXXXXX.Identity.Web\_ci\node_modules\grunt-debug-task\node_modules\node-inspector\node_modules\v8-profiler > > v8-debug@0.4.6 preinstall C:\a\02e68ad0\XXXX XXXXXX\Source\XXXXXXX.Identity\XXXXXXX.Identity.Web\_ci\node_modules\grunt-debug-task\node_modules\node-inspector\node_modules\v8-debug > npm WARN optional dep failed, continuing default-browser-id@1.0.2 npm WARN engine xmlbuilder@2.2.1: wanted: {"node":"0.8.x || 0.10.x"} (current: {"node":"0.12.7","npm":"2.11.3"}) > bufferutil@1.1.0 install C:\a\02e68ad0\XXXX XXXXXX\Source\XXXXXXX.Identity\XXXXXXX.Identity.Web\_ci\node_modules\grunt-debug-task\node_modules\node-inspector\node_modules\ws\node_modules\bufferutil > node-gyp rebuild C:\a\02e68ad0\XXXX XXXXXX\Source\XXXXXXX.Identity\XXXXXXX.Identity.Web\_ci\node_modules\grunt-debug-task\node_modules\node-inspector\node_modules\ws\node_modules\bufferutil>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node rebuild ) Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch. bufferutil.cc C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\exception(361): warning C4577: 'noexcept' used with no exception handling mode specified; termination on exception is not guaranteed. Specify /EHsc [C:\a\02e68ad0\XXXX XXXXXX\Source\XXXXXXX.Identity\XXXXXXX.Identity.Web\_ci\node_modules\grunt-debug-task\node_modules\node-inspector\node_modules\ws\node_modules\bufferutil\build\bufferutil.vcxproj] Creating library C:\a\02e68ad0\XXXX XXXXXX\Source\XXXXXXX.Identity\XXXXXXX.Identity.Web\_ci\node_modules\grunt-debug-task\node_modules\node-inspector\node_modules\ws\node_modules\bufferutil\build\Release\bufferutil.lib and object C:\a\02e68ad0\XXXX XXXXXX\Source\XXXXXXX.Identity\XXXXXXX.Identity.Web\_ci\node_modules\grunt-debug-task\node_modules\node-inspector\node_modules\ws\node_modules\bufferutil\build\Release\bufferutil.exp Generating code Finished generating code bufferutil.vcxproj -> C:\a\02e68ad0\XXXX XXXXXX\Source\XXXXXXX.Identity\XXXXXXX.Identity.Web\_ci\node_modules\grunt-debug-task\node_modules\node-inspector\node_modules\ws\node_modules\bufferutil\build\Release\\bufferutil.node > utf-8-validate@1.1.0 install C:\a\02e68ad0\XXXX XXXXXX\Source\XXXXXXX.Identity\XXXXXXX.Identity.Web\_ci\node_modules\grunt-debug-task\node_modules\node-inspector\node_modules\ws\node_modules\utf-8-validate > node-gyp rebuild C:\a\02e68ad0\XXXX XXXXXX\Source\XXXXXXX.Identity\XXXXXXX.Identity.Web\_ci\node_modules\grunt-debug-task\node_modules\node-inspector\node_modules\ws\node_modules\utf-8-validate>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node rebuild ) Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch. validation.cc C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\exception(361): warning C4577: 'noexcept' used with no exception handling mode specified; termination on exception is not guaranteed. Specify /EHsc [C:\a\02e68ad0\XXXX XXXXXX\Source\XXXXXXX.Identity\XXXXXXX.Identity.Web\_ci\node_modules\grunt-debug-task\node_modules\node-inspector\node_modules\ws\node_modules\utf-8-validate\build\validation.vcxproj] Creating library C:\a\02e68ad0\XXXX XXXXXX\Source\XXXXXXX.Identity\XXXXXXX.Identity.Web\_ci\node_modules\grunt-debug-task\node_modules\node-inspector\node_modules\ws\node_modules\utf-8-validate\build\Release\validation.lib and object C:\a\02e68ad0\XXXX XXXXXX\Source\XXXXXXX.Identity\XXXXXXX.Identity.Web\_ci\node_modules\grunt-debug-task\node_modules\node-inspector\node_modules\ws\node_modules\utf-8-validate\build\Release\validation.exp Generating code Finished generating code validation.vcxproj -> C:\a\02e68ad0\XXXX XXXXXX\Source\XXXXXXX.Identity\XXXXXXX.Identity.Web\_ci\node_modules\grunt-debug-task\node_modules\node-inspector\node_modules\ws\node_modules\utf-8-validate\build\Release\\validation.node > v8-profiler@5.2.12 install C:\a\02e68ad0\XXXX XXXXXX\Source\XXXXXXX.Identity\XXXXXXX.Identity.Web\_ci\node_modules\grunt-debug-task\node_modules\node-inspector\node_modules\v8-profiler > node-pre-gyp install --fallback-to-build Success: "C:\a\02e68ad0\XXXX XXXXXX\Source\XXXXXXX.Identity\XXXXXXX.Identity.Web\_ci\node_modules\grunt-debug-task\node_modules\node-inspector\node_modules\v8-profiler\build\profiler\v5.2.12\node-v14-win32-x64\profiler.node" is installed via remote > v8-debug@0.4.6 install C:\a\02e68ad0\XXXX XXXXXX\Source\XXXXXXX.Identity\XXXXXXX.Identity.Web\_ci\node_modules\grunt-debug-task\node_modules\node-inspector\node_modules\v8-debug > node-pre-gyp install --fallback-to-build C:\a\02e68ad0\XXXX XXXXXX\Source\XXXXXXX.Identity\XXXXXXX.Identity.Web\_ci\node_modules\grunt-debug-task\node_modules\node-inspector\node_modules\v8-debug>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" clean ) else (node clean ) C:\a\02e68ad0\XXXX XXXXXX\Source\XXXXXXX.Identity\XXXXXXX.Identity.Web\_ci\node_modules\grunt-debug-task\node_modules\node-inspector\node_modules\v8-debug>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" configure --fallback-to-build "--module=C:\a\02e68ad0\XXXX XXXXXX\Source\XXXXXXX.Identity\XXXXXXX.Identity.Web\_ci\node_modules\grunt-debug-task\node_modules\node-inspector\node_modules\v8-debug\build\debug\v0.4.6\node-v14-win32-x64\debug.node" --module_name=debug "--module_path=C:\a\02e68ad0\XXXX XXXXXX\Source\XXXXXXX.Identity\XXXXXXX.Identity.Web\_ci\node_modules\grunt-debug-task\node_modules\node-inspector\node_modules\v8-debug\build\debug\v0.4.6\node-v14-win32-x64" ) else (node configure --fallback-to-build "--module=C:\a\02e68ad0\XXXX XXXXXX\Source\XXXXXXX.Identity\XXXXXXX.Identity.Web\_ci\node_modules\grunt-debug-task\node_modules\node-inspector\node_modules\v8-debug\build\debug\... Warning: Missing input files: C:\a\02e68ad0\XXXX XXXXXX\Source\XXXXXXX.Identity\XXXXXXX.Identity.Web\_ci\node_modules\grunt-debug-task\node_modules\node-inspector\node_modules\v8-debug\build\..\..\..\..\..\..\..\..\..\..\..\..\..\..\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\src\win_delay_load_hook.c C:\a\02e68ad0\XXXX XXXXXX\Source\XXXXXXX.Identity\XXXXXXX.Identity.Web\_ci\node_modules\grunt-debug-task\node_modules\node-inspector\node_modules\v8-debug>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" build --fallback-to-build "--module=C:\a\02e68ad0\XXXX XXXXXX\Source\XXXXXXX.Identity\XXXXXXX.Identity.Web\_ci\node_modules\grunt-debug-task\node_modules\node-inspector\node_modules\v8-debug\build\debug\v0.4.6\node-v14-win32-x64\debug.node" --module_name=debug "--module_path=C:\a\02e68ad0\XXXX XXXXXX\Source\XXXXXXX.Identity\XXXXXXX.Identity.Web\_ci\node_modules\grunt-debug-task\node_modules\node-inspector\node_modules\v8-debug\build\debug\v0.4.6\node-v14-win32-x64" ) else (node build --fallback-to-build "--module=C:\a\02e68ad0\XXXX XXXXXX\Source\XXXXXXX.Identity\XXXXXXX.Identity.Web\_ci\node_modules\grunt-debug-task\node_modules\node-inspector\node_modules\v8-debug\build\debug\v0.4.6\n... Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch. debug.cc C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\exception(361): warning C4577: 'noexcept' used with no exception handling mode specified; termination on exception is not guaranteed. Specify /EHsc [C:\a\02e68ad0\XXXX XXXXXX\Source\XXXXXXX.Identity\XXXXXXX.Identity.Web\_ci\node_modules\grunt-debug-task\node_modules\node-inspector\node_modules\v8-debug\build\debug.vcxproj] win_delay_load_hook.c c1 : fatal error C1083: Cannot open source file: '..\..\..\..\..\..\..\..\..\..\..\..\..\..\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\src\win_delay_load_hook.c': No such file or directory [C:\a\02e68ad0\XXXX XXXXXX\Source\XXXXXXX.Identity\XXXXXXX.Identity.Web\_ci\node_modules\grunt-debug-task\node_modules\node-inspector\node_modules\v8-debug\build\debug.vcxproj] gyp ERR! build error gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\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:269:23) gyp ERR! stack at ChildProcess.emit (events.js:110:17) gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:1074:12) gyp ERR! System Windows_NT 6.3.9600 gyp ERR! command "node" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "build" "--fallback-to-build" "--module=C:\\a\\02e68ad0\\XXXX XXXXXX\\Source\\XXXXXXX.Identity\\XXXXXXX.Identity.Web\\_ci\\node_modules\\grunt-debug-task\\node_modules\\node-inspector\\node_modules\\v8-debug\\build\\debug\\v0.4.6\\node-v14-win32-x64\\debug.node" "--module_name=debug" "--module_path=C:\\a\\02e68ad0\\XXXX XXXXXX\\Source\\XXXXXXX.Identity\\XXXXXXX.Identity.Web\\_ci\\node_modules\\grunt-debug-task\\node_modules\\node-inspector\\node_modules\\v8-debug\\build\\debug\\v0.4.6\\node-v14-win32-x64" gyp ERR! cwd C:\a\02e68ad0\XXXX XXXXXX\Source\XXXXXXX.Identity\XXXXXXX.Identity.Web\_ci\node_modules\grunt-debug-task\node_modules\node-inspector\node_modules\v8-debug gyp ERR! node -v v0.12.7 gyp ERR! node-gyp -v v2.0.1 gyp ERR! not ok node-pre-gyp ERR! build error node-pre-gyp ERR! stack Error: Failed to execute 'node-gyp.cmd build --fallback-to-build --module=C:\a\02e68ad0\XXXX XXXXXX\Source\XXXXXXX.Identity\XXXXXXX.Identity.Web\_ci\node_modules\grunt-debug-task\node_modules\node-inspector\node_modules\v8-debug\build\debug\v0.4.6\node-v14-win32-x64\debug.node --module_name=debug --module_path=C:\a\02e68ad0\XXXX XXXXXX\Source\XXXXXXX.Identity\XXXXXXX.Identity.Web\_ci\node_modules\grunt-debug-task\node_modules\node-inspector\node_modules\v8-debug\build\debug\v0.4.6\node-v14-win32-x64' (1) node-pre-gyp ERR! stack at ChildProcess.<anonymous> (C:\a\02e68ad0\XXXX XXXXXX\Source\XXXXXXX.Identity\XXXXXXX.Identity.Web\_ci\node_modules\grunt-debug-task\node_modules\node-inspector\node_modules\v8-debug\node_modules\node-pre-gyp\lib\util\compile.js:83:29) node-pre-gyp ERR! stack at ChildProcess.emit (events.js:110:17) node-pre-gyp ERR! stack at maybeClose (child_process.js:1015:16) node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:1087:5) node-pre-gyp ERR! System Windows_NT 6.3.9600 node-pre-gyp ERR! command "node" "C:\\a\\02e68ad0\\XXXX XXXXXX\\Source\\XXXXXXX.Identity\\XXXXXXX.Identity.Web\\_ci\\node_modules\\grunt-debug-task\\node_modules\\node-inspector\\node_modules\\v8-debug\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build" node-pre-gyp ERR! cwd C:\a\02e68ad0\XXXX XXXXXX\Source\XXXXXXX.Identity\XXXXXXX.Identity.Web\_ci\node_modules\grunt-debug-task\node_modules\node-inspector\node_modules\v8-debug node-pre-gyp ERR! node -v v0.12.7 node-pre-gyp ERR! node-pre-gyp -v v0.6.11 node-pre-gyp ERR! not ok Failed to execute 'node-gyp.cmd build --fallback-to-build --module=C:\a\02e68ad0\XXXX XXXXXX\Source\XXXXXXX.Identity\XXXXXXX.Identity.Web\_ci\node_modules\grunt-debug-task\node_modules\node-inspector\node_modules\v8-debug\build\debug\v0.4.6\node-v14-win32-x64\debug.node --module_name=debug --module_path=C:\a\02e68ad0\XXXX XXXXXX\Source\XXXXXXX.Identity\XXXXXXX.Identity.Web\_ci\node_modules\grunt-debug-task\node_modules\node-inspector\node_modules\v8-debug\build\debug\v0.4.6\node-v14-win32-x64' (1) npm ERR! Windows_NT 6.3.9600 npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" npm ERR! node v0.12.7 npm ERR! npm v2.11.3 npm ERR! code ELIFECYCLE npm ERR! v8-debug@0.4.6 install: `node-pre-gyp install --fallback-to-build` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the v8-debug@0.4.6 install script 'node-pre-gyp install --fallback-to-build'. npm ERR! This is most likely a problem with the v8-debug package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node-pre-gyp install --fallback-to-build npm ERR! You can get their info via: npm ERR! npm owner ls v8-debug npm ERR! There is likely additional logging output above. npm ERR! Please include the following file with any support request: npm ERR! C:\a\02e68ad0\XXXX XXXXXX\Source\XXXXXXX.Identity\XXXXXXX.Identity.Web\_ci\npm-debug.log Unexpected exit code 1 returned from tool npm.cmd 

当我使用.cmd脚本的时候遇到了这个问题。 我做了一个npm更新,它工作正常。 在执行npm install之前,我在脚本上执行了以下命令

 npm install npm@latest npm update --depth=0 -g 

这让它工作。 但是当我在VSO中使用构build步骤时,我无法做到这一点。 为什么这个错误出现,我该如何解决这个问题。 另外我怎样才能做npm更新步骤VSO构build步骤?

您需要添加一个npm安装构build步骤。 默认情况下,工作目录的默认值是项目的根目录。 并在Arguments字段中指定npm install参数。 喜欢:

在这里输入图像说明