简体   繁体   中英

Cordova add platform error, with android

When I try tu run cordova platform add android , whether it's from a Ionic or Cordova Project, I get the following error:

/c/Users/USERNAME/AppData/Roaming/npm/cordova: line 14:  1200 Illegal instruction     node "$basedir/node_modules/cordova/bin/cordova" "$@"

This is my setup:

Cordova CLI: 6.2.0
Gulp version: CLI version 1.2.1
Gulp local:
Ionic CLI Version: 1.7.15
Ionic App Lib Version: 0.7.2
OS: Windows 7
Node Version: v4.4.0

These are my environment variables:

ANDROID_HOME: C:\Users\USERNAME\AppData\Local\Android\sdk
JAVA_HOME: C:\Program Files\Java\jdk1.8.0_92
Path: ;C:\Program Files (x86)\Microsoft VS Code\bin;%JAVA_HOME%\bin;C:\apache-ant-1.9.7\bin;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools;C:\Users\USERNAME\AppData\Roaming\npm

I've tried reinstalling cordova, ionic, npm and different versions of Node, but the error remains. Any ideas?

I believe your nodejs installation folder is not set in your Path system environment variable. Please ensure to add the same.

Once its done, try executing node -v command from command prompt. You should be able to see the nodejs version. Once this command execution is successful, you shoule ba able to add android platform.

我设法解决了,将Windows升级到Service Pack 1后,错误消失了

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM