最近準備開展app自動化測試,逐步搭建appium自動花測試框架
安裝準備
1.安裝nodejs
安裝完成后檢查 :
node -version
npm -version
2.安裝JDK
3.安裝Android SDK
準備環(huán)境完成:
1.暫緩cnpm
** npm install -g cnpm --registry=**[**https://registry.npm.taobao.org**](https://registry.npm.taobao.org/)
檢查是否成功:
cnpm -v
2.通過cnpm安裝appium server
cnpm install -g appium --no-cache
3.安裝完成后安裝appium-doctor
cnpm install -g appium-doctor
注意添加-g參數(shù),之后就可以在命令行運行appium-doctor查看appium運行環(huán)境是否配置正常
4.使用appium-doctor檢查是否正常
實踐過程中遇到報錯
at IncomingMessage.handleStreamEnd (C:\Users\user\AppData\Roaming\npm\node_modules\appium\node_modules\_axios@0.21.4@axios\lib\adapters\http.js:269:11)
at IncomingMessage.emit (node:events:406:35)
at endReadableNT (node:internal/streams/readable:1331:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
[08:54:38] Downloading Chromedriver can be skipped by using the '--chromedriver-skip-install' flag or setting the 'APPIUM_SKIP_CHROMEDRIVER_INSTALL' environment variable.
[npminstall:runscript:error] appium-android-driver@4.50.0 ? appium-chromedriver@^4.13.0 scripts.postinstall run "node install-npm.js" error: Error [RunScriptError]: Run "C:\WINDOWS\system32\cmd.exe /d /s /c node install-npm.js" error, exit code 1
at ChildProcess.<anonymous> (C:\Users\user\AppData\Roaming\npm\node_modules\cnpm\node_modules\runscript\index.js:96:21)
at ChildProcess.emit (node:events:394:28)
at maybeClose (node:internal/child_process:1067:16)
at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5) {
stdio: [Object],
exitcode: 1
}
Install fail! RunScriptError: post install error, please remove node_modules before retry!
Run "C:\WINDOWS\system32\cmd.exe /d /s /c node install-npm.js" error, exit code 1
RunScriptError: Run "C:\WINDOWS\system32\cmd.exe /d /s /c node install-npm.js" error, exit code 1
at ChildProcess.<anonymous> (C:\Users\user\AppData\Roaming\npm\node_modules\cnpm\node_modules\runscript\index.js:96:21)
at ChildProcess.emit (node:events:394:28)
at maybeClose (node:internal/child_process:1067:16)
at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
npminstall version: 5.1.1
npminstall args: D:\software\nodej\node.exe C:\Users\user\AppData\Roaming\npm\node_modules\cnpm\node_modules\npminstall\bin\install.js --fix-bug-versions --china --userconfig=C:\Users\user\.cnpmrc --disturl=https://npmmirror.com/mirrors/node --registry=https://registry.npmmirror.com -g appium --no-cache
解決方案
使用命令sudo npm install -g npm
重新安裝npm
啟動appium 成功