"Appium"不被识别为内部或外部命令,可执行程序或批处理文件。

5
尝试在Windows上安装appium,使用以下命令:npm install -g appium。但是我遇到了以下错误,请给我一些解决方案来解决这个问题。我刚刚下载了Windows的Appium,然后在命令提示符中尝试了npm install -g appium命令。
    C:\Users\Gideon>npm install -g appium
npm WARN `git config --get remote.origin.url` returned wrong result (git://githu
b.com/vojtajina/traceur-compiler) undefined
npm WARN `git config --get remote.origin.url` returned wrong result (git://githu
b.com/vojtajina/traceur-compiler) undefined
npm ERR! git clone git://github.com/vojtajina/traceur-compiler undefined
npm ERR! git clone git://github.com/vojtajina/traceur-compiler undefined
\


> bufferutil@1.0.1 install C:\Users\Gideon\AppData\Roaming\npm\node_modules\appi
um\node_modules\ws\node_modules\bufferutil
> node-gyp rebuild

|
C:\Users\Gideon\AppData\Roaming\npm\node_modules\appium\node_modules\ws\node_mod
ules\bufferutil>node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\
\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYT
HON env variable.
gyp ERR! stack     at failNoPython (C:\Program Files\nodejs\node_modules\npm\nod
e_modules\node-gyp\lib\configure.js:103:14)
gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node
-gyp\lib\configure.js:64:11
gyp ERR! stack     at Object.oncomplete (evalmachine.<anonymous>:108:15)
gyp ERR! System Windows_NT 6.2.9200
gyp ERR! command "node" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modu
les\\node-gyp\\bin\\node-gyp.js" "rebuild"
 ERR! cwd C:\Users\Gideon\AppData\Roaming\npm\node_modules\appium\node_modules\w
s\node_modules\bufferutil
gyp ERR! node -v v0.10.35
gyp ERR! node-gyp -v v1.0.1
gyp ERR! not ok
npm WARN optional dep failed, continuing bufferutil@1.0.1


> utf-8-validate@1.0.1 install C:\Users\Gideon\AppData\Roaming\npm\node_modules\
appium\node_modules\ws\node_modules\utf-8-validate
> node-gyp rebuild


C:\Users\Gideon\AppData\Roaming\npm\node_modules\appium\node_modules\ws\node_mod
ules\utf-8-validate>node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-
bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYT
HON env variable.
gyp ERR! stack     at failNoPython (C:\Program Files\nodejs\node_modules\npm\nod
e_modules\node-gyp\lib\configure.js:103:14)
gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node
-gyp\lib\configure.js:64:11
gyp ERR! stack     at Object.oncomplete (evalmachine.<anonymous>:108:15)
gyp ERR! System Windows_NT 6.2.9200
gyp ERR! command "node" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modu
les\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Gideon\AppData\Roaming\npm\node_modules\appium\node_module
s\ws\node_modules\utf-8-validate
gyp ERR! node -v v0.10.35
gyp ERR! node-gyp -v v1.0.1
gyp ERR! not ok
npm WARN optional dep failed, continuing utf-8-validate@1.0.1
-


> ws@0.5.0 install C:\Users\Gideon\AppData\Roaming\npm\node_modules\appium\node_
modules\socket.io\node_modules\engine.io\node_modules\ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)

|
C:\Users\Gideon\AppData\Roaming\npm\node_modules\appium\node_modules\socket.io\n
ode_modules\engine.io\node_modules\ws>node "C:\Program Files\nodejs\node_modules
\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild
|
> ws@0.4.31 install C:\Users\Gideon\AppData\Roaming\npm\node_modules\appium\node
_modules\socket.io\node_modules\socket.io-client\node_modules\engine.io-client\n
ode_modules\ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)


C:\Users\Gideon\AppData\Roaming\npm\node_modules\appium\node_modules\socket.io\n
ode_modules\socket.io-client\node_modules\engine.io-client\node_modules\ws>node
"C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\n
ode-gyp\bin\node-gyp.js" rebuild
npm WARN engine hawk@0.10.2: wanted: {"node":"0.8.x"} (current: {"node":"0.10.35
","npm":"1.4.28"})
npm WARN engine cryptiles@0.1.3: wanted: {"node":"0.8.x"} (current: {"node":"0.1
0.35","npm":"1.4.28"})
npm WARN engine hoek@0.7.6: wanted: {"node":"0.8.x"} (current: {"node":"0.10.35"
,"npm":"1.4.28"})
npm WARN engine boom@0.3.8: wanted: {"node":"0.8.x"} (current: {"node":"0.10.35"
,"npm":"1.4.28"})
npm WARN engine sntp@0.1.4: wanted: {"node":"0.8.x"} (current: {"node":"0.10.35"
,"npm":"1.4.28"})
npm ERR! not found: git
npm ERR!
npm ERR! Failed using git.
npm ERR! This is most likely not a problem with npm itself.
npm ERR! Please check if you have git installed and in your PATH.

npm ERR! System Windows_NT 6.2.9200
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nod
ejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "appium"
npm ERR! cwd C:\Users\Gideon
npm ERR! node -v v0.10.35
npm ERR! npm -v 1.4.28
npm ERR! code ENOGIT
npm ERR! not ok code 0


C:\Users\Gideon>appium 

“appium”未被识别为内部或外部命令,可执行程序或批处理文件。

你说你下载了Windows版的Appium,然后尝试使用npm install -g appium? - Devdutta Goyal
6个回答

13

我自己也挣扎了一整天,最终终于成功了。

NPM默认安装在C:\Program Files\nodejs下。

但其他所需的节点模块将会安装在C:\Users\UserName\AppData\Roaming\npm下。

系统环境变量的PATH将设置为C:\Program Files\nodejs,而不是C:\Users\UserName\AppData\Roaming\npm,因此请将该目录添加到PATH变量中。

设置另一个目录

然后将下载的appium文件夹复制
从: C:\Users\User\AppData\Roaming\npm\node_modules
到: C:\Program Files\nodejs\node_modules\npm\node_modules

然后全局运行命令appium --version就应该可以了。

已测试两次,对我有效,希望对所有人有帮助。

祝好, Vineeth


3

感谢您宝贵的意见!

我在此提供更多解决方案。

在安装时,

npm install -g appium

系统变量默认设置为C:\Program Files\nodejs\,这会导致以下错误:

'appium' 不是内部或外部命令,也不是可运行的程序或批处理文件。

要解决上述错误,您需要将系统变量设置为C:\Program Files\nodejs,因此如果您使用的是Windows10操作系统,请删除\;否则,请在语法末尾添加分号,如下所示:C:\Program Files\nodejs;

希望这样可以解决问题!


1
如果您通过命令 npm install -g appium 安装 Appium 时出现错误,请进行以下操作。
'appium' is not recognized as an internal or external command, operable program or batch file

在环境变量中添加一个新值到路径变量(控制面板->高级设置)。
C:\Users\YourUsername....\AppData\Roaming\npm\node_modules\appium\node_modules\.bin\

0

看起来你可能需要检查一下系统的PATH变量。

控制面板 -> 系统 -> 高级系统设置 -> 环境变量 -> 系统变量 -> 选择 PATH -> 编辑 ->

我的是:

C:\Ruby193\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0;C:\Program Files\Hewlett-Packard\SimplePass;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0;C:\Program Files\Microsoft SQL Server\110\Tools\Binn;C:\Program Files\Microsoft SQL Server\120\Tools\Binn;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn;C:\Program Files\Microsoft SQL Server\120\DTS\Binn;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio;C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0;C:\Program Files\Microsoft\Web Platform Installer;C:\Program Files (x86)\Microsoft SDKs\Azure\CLI\wbin;C:\Program Files (x86)\SimpleIDE\propeller-gcc\bin;c:\python27;c:\python27\scripts;C:\Program Files\nodejs;C:\Program Files (x86)\Git\cmd
请注意,我不得不手动添加RubyPythonpython\scriptsNodejsGit\cmd等路径,以便使它们生效。
您可能需要这样做,然后重新启动计算机以使其生效。

0

我在这里为nodemon提供了答案。但是同样适用于appium。要解决问题,请按照第2步操作-答案链接


0

在安装Node.js之后,您还可以尝试以下步骤:

1) 单击 开始 按钮
2) 搜索 Node.js 命令提示符 并打开它
3) 输入命令 npm install -g appium(它会开始安装)
5) 此外,关闭所有 Windows 的 cmd 窗口并启动新窗口
6) 搜索 appium -v 来检查是否已安装。

然后您就不会遇到问题了。我曾经苦苦挣扎一整天,但是按照这些步骤后,它终于起作用了。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接