使用'npm install -g [email protected]'安装appium时收到有关python版本错误的错误消息

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

我尝试使用'npm install -g [email protected]'命令安装appium。但是出现了这个错误。

https://www.screencast.com/t/iAJUYj59n4

注意:我安装了python 3.7。

如何正确安装此特定版本的appium?我用这个用于katalon。

C:\Users\heri.susilo>npm install -g [email protected]
npm WARN deprecated [email protected]: Moved to appium-android-driver
npm WARN deprecated [email protected]: Moved to io.appium.settings
npm WARN deprecated [email protected]: Moved to appium-android-bootstrap
npm WARN deprecated [email protected]: Moved to io.appium.settings
npm WARN deprecated [email protected]: cross-spawn no longer requires a build toolchain, use it instead
C:\Users\heri.susilo\AppData\Roaming\npm\appium -> C:\Users\heri.susilo\AppData\Roaming\npm\node_modules\appium\build\lib\main.js

> [email protected] install C:\Users\heri.susilo\AppData\Roaming\npm\node_modules\appium\node_modules\heapdump
> node-gyp rebuild


C:\Users\heri.susilo\AppData\Roaming\npm\node_modules\appium\node_modules\heapdump>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Command failed: C:\Users\heri.susilo\AppData\Local\Programs\Python\Python37\python.exe -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack   File "<string>", line 1
gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack                                ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:294:12)
gyp ERR! stack     at ChildProcess.emit (events.js:189:13)
gyp ERR! stack     at maybeClose (internal/child_process.js:970:16)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\heri.susilo\AppData\Roaming\npm\node_modules\appium\node_modules\heapdump
gyp ERR! node -v v10.15.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\appium\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\appium\node_modules\heapdump):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: `node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

+ [email protected]
updated 1 package in 53.815s
python npm appium katalon-studio
1个回答
0
投票

这是由于npm中错误的python版本引起的。将其更改为python2将解决问题。

npm config set python python2.7
© www.soinside.com 2019 - 2024. All rights reserved.