在macOS上安装Appium碰到的问题【iMac】【Mac第二次】

最近在iMac上第二次搭建 Appium,又碰到了许多新的问题,

比如 报错 “sh -c node install-npm.js ”error:

        

    

 

-iMac ~ % sudo cnpm install -g appium@1.17.1 --force
Downloading appium to /usr/local/lib/node_modules/appium_tmp
Copying /usr/local/lib/node_modules/appium_tmp/_appium@1.17.1@appium to /usr/local/lib/node_modules/appium
Installing appium's dependencies to /usr/local/lib/node_modules/appium/node_modules
[1/32] async-lock@^1.0.0 installed at node_modules/_async-lock@1.3.0@async-lock
[2/32] find-root@^1.1.0 installed at node_modules/_find-root@1.1.0@find-root
[3/32] bluebird@3.x installed at node_modules/_bluebird@3.7.2@bluebird
[4/32] fsevents@2.x installed at node_modules/_fsevents@2.3.2@fsevents
[5/32] dateformat@^3.0.3 installed at node_modules/_dateformat@3.0.3@dateformat
[6/32] word-wrap@^1.2.3 installed at node_modules/_word-wrap@1.2.3@word-wrap
[7/32] longjohn@^0.2.12 installed at node_modules/_longjohn@0.2.12@longjohn
[8/32] @babel/runtime@^7.6.0 installed at node_modules/_@babel_runtime@7.14.8@@babel/runtime
[9/32] lodash@^4.17.11 installed at node_modules/_lodash@4.17.21@lodash
[10/32] appium-mac-driver@1.x installed at node_modules/_appium-mac-driver@1.10.2@appium-mac-driver
[11/32] appium-windows-driver@1.x installed at node_modules/_appium-windows-driver@1.19.0@appium-windows-driver
[12/32] asyncbox@2.x installed at node_modules/_asyncbox@2.8.0@asyncbox
[13/32] teen_process@1.x installed at node_modules/_teen_process@1.16.0@teen_process
[14/32] argparse@^1.0.10 installed at node_modules/_argparse@1.0.10@argparse
[15/32] request-promise@4.x installed at node_modules/_request-promise@4.2.6@request-promise
[16/32] source-map-support@0.x installed at node_modules/_source-map-support@0.5.19@source-map-support
[17/32] appium-espresso-driver@^1.0.0 installed at node_modules/_appium-espresso-driver@1.45.1@appium-espresso-driver
[18/32] appium-uiautomator2-driver@^1.37.1 installed at node_modules/_appium-uiautomator2-driver@1.67.0@appium-uiautomator2-driver
[19/32] appium-xcuitest-driver@^3.22.0 installed at node_modules/_appium-xcuitest-driver@3.50.1@appium-xcuitest-driver
[20/32] semver@^7.0.0 installed at node_modules/_semver@7.3.5@semver
[21/32] appium-android-driver@^4.20.0 installed at node_modules/_appium-android-driver@4.47.0@appium-android-driver
[22/32] continuation-local-storage@3.x installed at node_modules/_continuation-local-storage@3.2.1@continuation-local-storage
[23/32] request@^2.81.0 installed at node_modules/_request@2.88.2@request
[24/32] appium-ios-driver@4.x installed at node_modules/_appium-ios-driver@4.8.3@appium-ios-driver
[25/32] npmlog@4.x installed at node_modules/_npmlog@4.1.2@npmlog
[26/32] appium-flutter-driver@^0 installed at node_modules/_appium-flutter-driver@0.0.29@appium-flutter-driver
[27/32] appium-fake-driver@^0.x installed at node_modules/_appium-fake-driver@0.10.0@appium-fake-driver
[28/32] appium-youiengine-driver@^1.2.0 installed at node_modules/_appium-youiengine-driver@1.2.9@appium-youiengine-driver
[29/32] appium-base-driver@^5.0.0 installed at node_modules/_appium-base-driver@5.8.1@appium-base-driver
[30/32] appium-tizen-driver@^1.1.1-beta.4 installed at node_modules/_appium-tizen-driver@1.1.1-beta.5@appium-tizen-driver
[31/32] winston@3.x installed at node_modules/_winston@3.3.3@winston
[32/32] appium-support@2.x installed at node_modules/_appium-support@2.54.1@appium-support
execute post install 3 scripts...
[1/3] scripts.install appium-windows-driver@1.x run "node install-npm.js", root: "/usr/local/lib/node_modules/appium/node_modules/_appium-windows-driver@1.19.0@appium-windows-driver"
Not installing WinAppDriver since did not detect a Windows system
[1/3] scripts.install appium-windows-driver@1.x finished in 358ms
[2/3] scripts.postinstall appium-uiautomator2-driver@1.67.0 › appium-chromedriver@^4.23.1 run "node install-npm.js", root: "/usr/local/lib/node_modules/appium/node_modules/_appium-chromedriver@4.27.3@appium-chromedriver"
[20:58:33] Error installing Chromedriver: Request failed with status code 404
[20:58:33] Error: Request failed with status code 404
    at createError (/usr/local/lib/node_modules/appium/node_modules/_axios@0.21.1@axios/lib/core/createError.js:16:15)
    at settle (/usr/local/lib/node_modules/appium/node_modules/_axios@0.21.1@axios/lib/core/settle.js:17:12)
    at IncomingMessage.handleStreamEnd (/usr/local/lib/node_modules/appium/node_modules/_axios@0.21.1@axios/lib/adapters/http.js:260:11)
    at IncomingMessage.emit (events.js:387:35)
    at endReadableNT (internal/streams/readable.js:1317:12)
    at processTicksAndRejections (internal/process/task_queues.js:82:21)
[20:58:33] 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-uiautomator2-driver@1.67.0 › appium-chromedriver@^4.23.1 scripts.postinstall run "node install-npm.js" error: Error [RunScriptError]: Run "sh -c node install-npm.js" error, exit code 1
    at ChildProcess.<anonymous> (/usr/local/lib/node_modules/cnpm/node_modules/runscript/index.js:96:21)
    at ChildProcess.emit (events.js:375:28)
    at maybeClose (internal/child_process.js:1055:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5) {
  stdio: [Object],
  exitcode: 1
}
Install fail! RunScriptError: post install error, please remove node_modules before retry!
Run "sh -c node install-npm.js" error, exit code 1
RunScriptError: Run "sh -c node install-npm.js" error, exit code 1
    at ChildProcess.<anonymous> (/usr/local/lib/node_modules/cnpm/node_modules/runscript/index.js:96:21)
    at ChildProcess.emit (events.js:375:28)
    at maybeClose (internal/child_process.js:1055:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
npminstall version: 5.0.1
npminstall args: /usr/local/bin/node /usr/local/lib/node_modules/cnpm/node_modules/npminstall/bin/install.js --fix-bug-versions --china --userconfig=/Users/xxxx/.cnpmrc --disturl=https://npm.taobao.org/mirrors/node --registry=https://registry.nlark.com -g appium@1.17.1 --force

 

 

经验告诉我,肯定又是node的问题,于是,重新卸载node、再重新安装node。

( node Mac 彻底卸载 :https://www.cnblogs.com/everlose/p/12846234.html

 

结果居然不行!!!

 

另外还尝试了:

1)jenkins执行npm install 或cnpm install时安装chromeDriver报错:http://zpycloud.com/archives/1251

——也不行 

2)npm安装Appium报错 Error: Request failed with status code 404,[npminstall:runscript:error] appium-android:https://blog.csdn.net/moso_wang/article/details/116132319

解决办法:先删除npm下面的node_modules的东西,

然后执行下面的命令:

npm config set registry https://registry.npm.taobao.org

npm install appium -g --chromedriver_cdnurl=http://cdn.npm.taobao.org/dist/chromedriver

——也不行 

3) 

 

最终尝试这个方法获救!!!!

搜索:appium-chromedriver@4.27.1 postinstall: `node install-npm.js`

【appium-chromedriver@4.26.2 postinstall: `node install-npm.js` 报错 解决办法:https://blog.csdn.net/weixin_43928801/article/details/116018380

   救命的 key word :

提示npm中有文件缺失,重新安装更新npm后就可以安装了

使用命令sudo npm install -g npm

—— 就是需要重新安装下 npm !!!

因为 前面的 npm 是没有单独安装的,而是在安装 node的时候,自动装了 npm 。

 

 

 

 

终于可以!:

 

安装完 appium-doctor后检查,终于可以了!!

   

 

posted on 2021-07-30 20:32  CuriousZero  阅读(1120)  评论(0编辑  收藏  举报

导航