运行批处理文件时出现Bamboo错误,但我可以手动运行它

问题描述 投票:5回答:1

我有一个包含以下内容的批处理文件:

@echo ON
echo "start"
echo "${bamboo.agentWorkingDirectory}"
CALL "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\VsDevCmd.bat"
cd "${bamboo.build.working.directory}/server"
CALL npm install --msvs_version=2012
exit

我使用这个批处理文件通过Bamboo安装OracleDB。

当我手动运行这个批处理文件时,一切安装都很好,一切都很开心。但是,当我让Bamboo运行完全相同的批处理文件时,我收到以下错误:

build   15-Oct-2015 16:53:04    E:\bamboo-agent-home\xml-data\build-dir\EC-ECB-BE\server\node_modules\oracledb>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 ) 
build   15-Oct-2015 16:53:06    Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
build   15-Oct-2015 16:53:06      njsOracle.cpp
build   15-Oct-2015 16:53:06      njsPool.cpp
build   15-Oct-2015 16:53:07      njsConnection.cpp
build   15-Oct-2015 16:53:07      njsMessages.cpp
build   15-Oct-2015 16:53:07      dpiEnv.cpp
build   15-Oct-2015 16:53:07      dpiEnvImpl.cpp
build   15-Oct-2015 16:53:07      dpiException.cpp
build   15-Oct-2015 16:53:07      dpiExceptionImpl.cpp
build   15-Oct-2015 16:53:07      dpiConnImpl.cpp
build   15-Oct-2015 16:53:07      dpiDateTimeArrayImpl.cpp
build   15-Oct-2015 16:53:07      dpiPoolImpl.cpp
build   15-Oct-2015 16:53:07      dpiStmtImpl.cpp
build   15-Oct-2015 16:53:07      dpiUtils.cpp
build   15-Oct-2015 16:53:07    e:\bamboo-agent-home\xml-data\build-dir\ec-ecb-be\server\node_modules\oracledb\src\njs\src\njsConnection.h(54): fatal error C1083: Cannot open include file: 'node.h': No such file or directory (..\src\njs\src\njsConnection.cpp) [E:\bamboo-agent-home\xml-data\build-dir\EC-ECB-BE\server\node_modules\oracledb\build\oracledb.vcxproj]
build   15-Oct-2015 16:53:07    ..\src\njs\src\njsPool.cpp(51): fatal error C1083: Cannot open include file: 'node.h': No such file or directory [E:\bamboo-agent-home\xml-data\build-dir\EC-ECB-BE\server\node_modules\oracledb\build\oracledb.vcxproj]
build   15-Oct-2015 16:53:07    ..\src\njs\src\njsOracle.cpp(51): fatal error C1083: Cannot open include file: 'node.h': No such file or directory [E:\bamboo-agent-home\xml-data\build-dir\EC-ECB-BE\server\node_modules\oracledb\build\oracledb.vcxproj]
error   15-Oct-2015 16:53:08    gyp ERR! build error 
error   15-Oct-2015 16:53:08    gyp ERR! stack Error: `msbuild` failed with exit code: 1
error   15-Oct-2015 16:53:08    gyp ERR! stack     at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:269:23)
error   15-Oct-2015 16:53:08    gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
error   15-Oct-2015 16:53:08    gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1074:12)
error   15-Oct-2015 16:53:08    gyp ERR! System Windows_NT 6.1.7601
error   15-Oct-2015 16:53:08    gyp ERR! command "node" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
error   15-Oct-2015 16:53:08    gyp ERR! cwd E:\bamboo-agent-home\xml-data\build-dir\EC-ECB-BE\server\node_modules\oracledb
error   15-Oct-2015 16:53:08    gyp ERR! node -v v0.12.7
error   15-Oct-2015 16:53:08    gyp ERR! node-gyp -v v2.0.1
error   15-Oct-2015 16:53:08    gyp ERR! not ok 
error   15-Oct-2015 16:53:08    npm ERR! Windows_NT 6.1.7601
error   15-Oct-2015 16:53:08    npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--msvs_version=2012"
error   15-Oct-2015 16:53:08    npm ERR! node v0.12.7
error   15-Oct-2015 16:53:08    npm ERR! npm  v2.11.3

常规窗口环境和我刚刚没有设置的竹子环境之间必定存在差异。我在Bamboo任务中设置了以下环境变量:

TEMP="C:\temp" TMP="C:\temp" GYP_MSVS_VERSION="2012"   
OCI_LIB_DIR="C:\oracle\instantclient\sdk\lib\msvc"   
OCI_INC_DIR="C:\oracle\instantclient\sdk\include"

我怎样才能解决这个问题?

windows oracle batch-file bamboo
1个回答
0
投票

运行:node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\n‌​ode-gyp.js" rebuild。这应该会产生错误。

如果它不会产生错误,那么npm_config_node_gyp可能会被Bamboo修改为cwd。在这种情况下,请将正确的值设置为环境变量。

如果它确实发出错误,请检查node.h文件或src目录中的%USERPROFILE%/.node-gyp/文件夹,希望它不存在并重新安装node-gyp应该使它工作。

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