issues in installing Cordova and ionic - android

why couldn't install Cordova... it says power shell is not recognized. What does it mean? and how do I fix it? I have tried some basic commands like
changing my path
System variables > Path > C:\Users\me\AppData\Local\Android\Sdk\platform-tools
npm install -g cordova-res
npm install -g ionic cordova-res
npm install cordova-res-generator -g
cordova-res-generator
rror: Command failed: powershell (Get-CimInstance -ClassName Win32_OperatingSystem).caption
'powershell' is not recognized as an internal or external command,
operable program or batch file.
at makeError (C:\Users\Node\AppData\Roaming\npm\node_modules\cordova\node_modules\windows-release\node_modules\execa\index.js:174:9)
at Function.module.exports.sync (C:\Users\Node\AppData\Roaming\npm\node_modules\cordova\node_modules\windows-release\node_modules\execa\index.js:338:15)
at windowsRelease (C:\Users\Node\AppData\Roaming\npm\node_modules\cordova\node_modules\windows-release\index.js:39:19)
at osName (C:\Users\Node\AppData\Roaming\npm\node_modules\cordova\node_modules\os-name\index.js:39:18)
at new Insight (C:\Users\Node\AppData\Roaming\npm\node_modules\cordova\node_modules\insight\lib\index.js:37:13)
at new RelentlessInsight (C:\Users\Node\AppData\Roaming\npm\node_modules\cordova\src\telemetry.js:31:1)
at Object.<anonymous> (C:\Users\Node\AppData\Roaming\npm\node_modules\cordova\src\telemetry.js:39:15)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32) {
code: 1,
stdout: '',
stderr: "'powershell' is not recognized as an internal or external command,\r\n" +
'operable program or batch file.\r\n',
failed: true,
signal: null,
cmd: 'powershell (Get-CimInstance -ClassName Win32_OperatingSystem).caption',
timedOut: false
}

Welcome!
I'm not a Windows user, but looks like you don't have the powershell cmd on your PATH.
Add this on your system environment:
%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\

Related

Command failed with exit code enoent on IONIC 4

The error on the above title only occurs on this specific project, when I build a Blank project it doesn't get this error. I've tried the other solutions to this problem but I just can't seem to get this working.
Heres the error message:
No scripts found for hook "after_prepare".
No scripts found for hook "before_compile".
ANDROID_HOME=C:\Users\ME\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_211
Running command: cmd "/s /c ""C:\Program Files (x86)\gradle-5.6.2\bin\gradle.bat" -p C:\Windows\System32\QRID2\qrid\platforms\android wrapper -b C:\Windows\System32\QRID2\qrid\platforms\android\wrapper.gradle""
Command finished with error code ENOENT: cmd /s /c ""C:\Program Files (x86)\gradle-5.6.2\bin\gradle.bat" -p C:\Windows\System32\QRID2\qrid\platforms\android wrapper -b C:\Windows\System32\QRID2\qrid\platforms\android\wrapper.gradle"
cmd: Command failed with exit code ENOENT
Error: cmd: Command failed with exit code ENOENT
at ChildProcess.whenDone (C:\Windows\System32\QRID2\qrid\platforms\android\cordova\node_modules\cordova-common\src\superspawn.js:169:23)
at ChildProcess.emit (events.js:198:13)
at Process.ChildProcess._handle.onexit (internal/child_process.js:246:12)
at onErrorNT (internal/child_process.js:415:16)
at process._tickCallback (internal/process/next_tick.js:63:19)
This means ENOENT Error NO ENTity|ENTry so such derectory
check your gradle is located in C:\Program Files (x86)\gradle-5.6.2
Do you have the gradle installed on your machine?
Try it:
1 - download the gradle from the site gradle.org.
Download the .zip file and extract to disk C:\
2 - Set the Gradle Environment Variables.
In order for the Gradle executable to be visible on the Windows command line, you must set the GRADLE_HOME variable and expose it in the system path.
Example:
variable name: GRADLE_HOME
variable value: c:\gradle-2.5
and then add GRADLE_HOME to Path
;%GRADLE_HOME%\bin
Restart your PC and use de command line
gradle -version
To see if it works

How to fix this Error: spawn EACCES - ionic cordova build ios

imac-de-mac-2:cov mac$ ionic cordova build ios
ionic-app-scripts build --target cordova --platform ios
Error: spawn EACCES
at exports._errnoException (util.js:1018:11)
at ChildProcess.spawn (internal/child_process.js:319:11)
at Object.exports.spawn (child_process.js:378:9)
at spawn (/usr/local/lib/node_modules/ionic/node_modules/cross-spawn/index.js:17:18)
at spawn (/usr/local/lib/node_modules/ionic/node_modules/#ionic/cli-framework/utils/shell.js:124:12)
at ShellCommand.spawn (/usr/local/lib/node_modules/ionic/node_modules/#ionic/cli-framework/utils/shell.js:113:16)
at ShellCommand.run (/usr/local/lib/node_modules/ionic/node_modules/#ionic/cli-framework/utils/shell.js:80:24)
at Shell.<anonymous> (/usr/local/lib/node_modules/ionic/node_modules/#ionic/cli-utils/lib/shell.js:32:37)
at next (native)
at /usr/local/lib/node_modules/ionic/node_modules/tslib/tslib.js:107:75
I'm sorry about my first answer/comment that I have the same error.
Now I think I find out the solution:
You must set the correct permission in your App/Project folder with the following command:
chmod -Rv 755 *

Failed to find 'ANDROID_HOME' environment variable. Failed to find 'android' command in your 'PATH'

I'm trying to build the default Hello World phonegap project for android on my ubuntu system, but I am confronted by errors at every step.
SHORT VERSION:
I cannot create a phonegap project without sudo (not quite true--see below).
After creating a phonegap project with sudo, I cannot build android without sudo.
When I type "sudo phonegap build android", I lose my path settings, resulting in an error.
I have attempted a fix for this last problem by including the line "alias sudo='sudo env PATH=$PATH'" in.bashrc, as suggested in sudo changes PATH - why?, but it doesn't work. I also added ANDROID_HOME and PATH lines to .bash_profile, with no success.
I think the 'android' command actually is in my path.
Here are the last lines of my .bashrc:
export PATH="$HOME/Android/tools:$PATH"
export PATH="$HOME/Android/platform-tools:$PATH"
export ANDROID_HOME="$HOME/Android:$PATH"
alias sudo='sudo env PATH=$PATH'
I also have the following in ~/.bash_profile:
export PATH="$HOME/Android/tools:$PATH"
export PATH="$HOME/Android/platform-tools:$PATH"
export ANDROID_HOME="$HOME/Android:$PATH"
LONG VERSION:
gregory#gregory-1001PXD:~/javascript$ phonegap create phonetest
Error: EACCES, permission denied '/home/gregory/.config/configstore/update-notifier-cordova.json'
You don't have access to this file.
at Object.fs.openSync (fs.js:432:18)
at Object.fs.readFileSync (fs.js:286:15)
at Object.create.all.get (/usr/local/lib/node_modules/phonegap/node_modules/cordova/node_modules/update-notifier/node_modules/configstore/index.js:34:26)
at Object.Configstore (/usr/local/lib/node_modules/phonegap/node_modules/cordova/node_modules/update-notifier/node_modules/configstore/index.js:27:44)
at new UpdateNotifier (/usr/local/lib/node_modules/phonegap/node_modules/cordova/node_modules/update-notifier/index.js:34:17)
at module.exports (/usr/local/lib/node_modules/phonegap/node_modules/cordova/node_modules/update-notifier/index.js:123:23)
at checkForUpdates (/usr/local/lib/node_modules/phonegap/node_modules/cordova/src/cli.js:64:20)
at cli (/usr/local/lib/node_modules/phonegap/node_modules/cordova/src/cli.js:114:5)
at Object.<anonymous> (/usr/local/lib/node_modules/phonegap/node_modules/cordova/bin/cordova:41:1)
at Module._compile (module.js:456:26)
gregory#gregory-1001PXD:~/javascript$ sudo phonegap create phonetest
[sudo] password for gregory:
Creating a new cordova project.
gregory#gregory-1001PXD:~/javascript$ cd phonetest/
gregory#gregory-1001PXD:~/javascript/phonetest$ sudo phonegap build android
[phonegap] executing 'cordova build android'...
cp: no such file or directory: /home/gregory/javascript/phonetest/icon.png
Running command: /home/gregory/javascript/phonetest/platforms/android/cordova/build
[Error: Failed to find 'ANDROID_HOME' environment variable. Try setting setting it manually.
Failed to find 'android' command in your 'PATH'. Try update your 'PATH' to include path to valid SDK directory.]
ERROR building one of the platforms: Error: /home/gregory/javascript/phonetest/platforms/android/cordova/build: Command failed with exit code 2
You may not have the required environment or OS to build this project
Error: /home/gregory/javascript/phonetest/platforms/android/cordova/build: Command failed with exit code 2
Bu I think the android command is in my PATH (it tab-completes).
NOTE: I can create a project without sudo if I remove the file update-notifier-cordova.json. But it still produces an error, as follows.
gregory#gregory-1001PXD:~/javascript$ sudo mv /home/gregory/.config/configstore/update-notifier-cordova.json ~/Documents/
gregory#gregory-1001PXD:~/javascript$ phonegap create phonetest
Creating a new cordova project.
gregory#gregory-1001PXD:~/javascript$ cd phonetest/
gregory#gregory-1001PXD:~/javascript/phonetest$ phonegap build android
[phonegap] executing 'cordova platform add --save android'...
Error: Failed to fetch platform android#~4.1.0
Probably this is either a connection problem, or platform spec is incorrect.
Check your connection and platform name/version/URL.
Error: EACCES, open '/home/gregory/.cordova/lib/npm_cache/cordova-android/4.1.1/package/.npmignore'
[phonegap] executing 'cordova build android'...
Error: No platforms added to this project. Please use `cordova platform add <platform>`.
This is documented in their JIRA: https://issues.apache.org/jira/browse/CB-10062
Check the ownership of the file using:
ls -al /home/gregory/.config/configstore/update-notifier-cordova.json
If it is root, you may want to try reinstalling cordova - otherwise use the workaround suggested by running:
chmod 744 /home/gregory/.config/configstore/update-notifier-cordova.json

Many Errors and Warnings when try to install phonegap

i have a source code of a mobile application written using phonegap and i want to build it to the Android (APK) and IOS versions, the source code is larger than that using phone gap online build service or XDK online build service so i tried to install phonegap and build my application using eclipse for android and xcode for ios.
i already have JDK, Android studio and i also configured all the needed configuration for JAVA, Android, Git in System Variable path key.
When i using command line to install phone gap like this "npm install -g phonegap" i have a lot of warnings and errors:
C:\Users\ahmed.marzouk>npm install -g phonegap
npm WARN addRemoteGit Error: Command failed: git -c core.longpaths=true config -
-get remote.origin.url
npm WARN addRemoteGit
npm WARN addRemoteGit at ChildProcess.exithandler (child_process.js:751:12)
npm WARN addRemoteGit at ChildProcess.emit (events.js:110:17)
npm WARN addRemoteGit at maybeClose (child_process.js:1015:16)
npm WARN addRemoteGit at Socket.<anonymous> (child_process.js:1183:11)
npm WARN addRemoteGit at Socket.emit (events.js:107:17)
npm WARN addRemoteGit at Pipe.close (net.js:485:12)
npm WARN addRemoteGit git+https://github.com/filmaj/node-plist.git resetting re
mote C:\Users\ahmed.marzouk\AppData\Roaming\npm-cache\_git-remotes\https-github-
com-filmaj-node-plist-git-653fe22e because of error: { [Error: Command failed: g
it -c core.longpaths=true config --get remote.origin.url
npm WARN addRemoteGit ]
npm WARN addRemoteGit killed: false,
npm WARN addRemoteGit code: 1,
npm WARN addRemoteGit signal: null,
npm WARN addRemoteGit cmd: 'git -c core.longpaths=true config --get remote.ori
gin.url' }
npm WARN addRemoteGit Error: Command failed: git -c core.longpaths=true config -
-get remote.origin.url
npm WARN addRemoteGit
npm WARN addRemoteGit at ChildProcess.exithandler (child_process.js:751:12)
npm WARN addRemoteGit at ChildProcess.emit (events.js:110:17)
npm WARN addRemoteGit at maybeClose (child_process.js:1015:16)
npm WARN addRemoteGit at Socket.<anonymous> (child_process.js:1183:11)
npm WARN addRemoteGit at Socket.emit (events.js:107:17)
npm WARN addRemoteGit at Pipe.close (net.js:485:12)
npm WARN addRemoteGit git+https://github.com/imhotep/plugman.git#0.5.7 resettin
g remote C:\Users\ahmed.marzouk\AppData\Roaming\npm-cache\_git-remotes\https-git
hub-com-imhotep-plugman-git-20c32d58 because of error: { [Error: Command failed:
git -c core.longpaths=true config --get remote.origin.url
npm WARN addRemoteGit ]
npm WARN addRemoteGit killed: false,
npm WARN addRemoteGit code: 1,
npm WARN addRemoteGit signal: null,
npm WARN addRemoteGit cmd: 'git -c core.longpaths=true config --get remote.ori
gin.url' }
npm WARN engine ncallbacks#1.0.0: wanted: {"node":"~0.6.7"} (current: {"node":"0
.12.5","npm":"2.11.2"})
-
> cordova#2.7.4 install C:\Users\ahmed.marzouk\AppData\Roaming\npm\node_modules\
phonegap\node_modules\cordova
> node bootstrap.js
SUCCESS: Minimum requirements for blackberry met.
BOOTSTRAPPING blackberry...
WARNING: Your system does not meet requirements to create wp7 projects. See erro
r output below.
'C:\Users\ahmed.marzouk\AppData\Roaming\npm\node_modules\phonegap\node_modules\c
ordova\lib\cordova-wp7\bin\check_reqs' is not recognized as an internal or exter
nal command,
operable program or batch file.
SKIPPING wp7 bootstrap.
WARNING: Your system does not meet requirements to create ios projects. See erro
r output below.
Xcode is (probably) not installed, specifically the command `xcodebuild` is unav
ailable or erroring out. Output of `xcodebuild -version` is: 'xcodebuild' is not
recognized as an internal or external command,
operable program or batch file.
SKIPPING ios bootstrap.
WARNING: Your system does not meet requirements to create wp8 projects. See erro
r output below.
'C:\Users\ahmed.marzouk\AppData\Roaming\npm\node_modules\phonegap\node_modules\c
ordova\lib\cordova-wp7\bin\check_reqs' is not recognized as an internal or exter
nal command,
operable program or batch file.
SKIPPING wp8 bootstrap.
ERROR! Could not create a native blackberry project test fixture. See below for
error output.
Missing one of the following:
JDK: http://java.oracle.com
Apache ant: http://ant.apache.org
WARNING: Your system does not meet requirements to create android projects. See
error output below.
Please install Android target 17 (the Android 4.2 SDK). Make sure you have the l
atest Android tools installed as well. Run `android` from your command-line to i
nstall/update any missing SDKs or tools.
SKIPPING android bootstrap.
C:\Users\ahmed.marzouk\AppData\Roaming\npm\phonegap -> C:\Users\ahmed.marzouk\Ap
pData\Roaming\npm\node_modules\phonegap\bin\phonegap.js
phonegap#0.9.4 C:\Users\ahmed.marzouk\AppData\Roaming\npm\node_modules\phonegap
├── colors#0.6.2
├── semver#1.1.0
├── qrcode-terminal#0.9.5
├── shelljs#0.0.9
├── optimist#0.3.7 (wordwrap#0.0.3)
├── node-static#0.6.9 (mime#1.3.4)
├── phonegap-build#0.8.0 (qrcode-terminal#0.8.0, phonegap-build-api#0.3.3)
├── prompt#0.2.14 (pkginfo#0.3.0, revalidator#0.1.8, read#1.0.6, winston#0.8.3,
utile#0.2.1)
└── cordova#2.7.4 (ncallbacks#1.0.0, open#0.0.3, shelljs#0.1.2, elementtree#0.1.
3, request#2.11.4, xcode#0.5.1, prompt#0.2.7, plist#0.4.0, express#3.0.6, ripple
-emulator#0.9.29, plugman#0.5.6)
I need to know, is the phonegap installing correctly or not? and if not, how can i solve this issue?
Thanks
I found the solution.
First thing if you have any issue in git like 'git path not found' you should follow the instructions here: installing-git-in-path.
To solve the above problem you should:
first run your cmd as admin it will solve half of the problem.
If there are any issue related toAndroid SDK like
WARNING: Your system does not meet requirements to create android projects. See
error output below.
Please install Android target 17 (the Android 4.2 SDK).
in cmd >
android
then check Android 4.2 SDK and install it.
Thanks

The Android Command for Ionic Framework does not work in Windows 8 CLI?

I am on Windows 8 and following through how to install and use Cordova with Ionic Framework on Windows 8.1. I followed through the video here: http://learn.ionicframework.com/videos/windows-android/. I am stuck at 5:58 of the video where the SDK Manager is suppose to come up when I type 'android' in the command line, but it says it's unrecognizable command. I made sure my file directories are exact. What else am I missing? How do I fix this problem?
PATH
C:\Users\Jaime\AppData\Roaming\npm; C:\Program Files\Java\jdk1.8.0_25\bin; C:\Development\AndroidSDK\sdk\platform-tools; C:\Development\AndroidSDK\sdk\tools; C:\Development\ApacheAnt\bin; C:\Program Files\nodejs
Thanks!
Problem with Android command:
C:\Users\Jaime\myapp>ionic platform add android
npm http GET https://registry.npmjs.org/cordova-android/3.6.4
npm http 200 https://registry.npmjs.org/cordova-android/3.6.4
npm http GET https://registry.npmjs.org/cordova-android/-/cordova-android-3.6.4.
tgz
npm http 200 https://registry.npmjs.org/cordova-android/-/cordova-android-3.6.4.
tgz
Creating android project...
C:\Users\Jaime\.cordova\lib\npm_cache\cordova-android\3.6.4\package\bin\node_mod
ules\q\q.js:126
throw e;
^
Error: ANDROID_HOME is not set and "android" command not in your PATH. You must
fulfill at least one of these conditions.
at C:\Users\Jaime\.cordova\lib\npm_cache\cordova-android\3.6.4\package\bin\l
ib\check_reqs.js:159:19
at _fulfilled (C:\Users\Jaime\.cordova\lib\npm_cache\cordova-android\3.6.4\p
ackage\bin\node_modules\q\q.js:798:54)
at self.promiseDispatch.done (C:\Users\Jaime\.cordova\lib\npm_cache\cordova-
android\3.6.4\package\bin\node_modules\q\q.js:827:30)
at Promise.promise.promiseDispatch (C:\Users\Jaime\.cordova\lib\npm_cache\co
rdova-android\3.6.4\package\bin\node_modules\q\q.js:760:13)
at C:\Users\Jaime\.cordova\lib\npm_cache\cordova-android\3.6.4\package\bin\n
ode_modules\q\q.js:821:14
at flush (C:\Users\Jaime\.cordova\lib\npm_cache\cordova-android\3.6.4\packag
e\bin\node_modules\q\q.js:108:17)
at process._tickCallback (node.js:415:13)
at Function.Module.runMain (module.js:499:11)
at startup (node.js:119:16)
at node.js:902:3
Error: C:\Users\Jaime\.cordova\lib\npm_cache\cordova-android\3.6.4\package\bin\c
reate.bat: Command failed with exit code 8
at ChildProcess.whenDone (C:\Users\Jaime\AppData\Roaming\npm\node_modules\co
rdova\node_modules\cordova-lib\src\cordova\superspawn.js:135:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:743:16)
at Process.ChildProcess._handle.onexit (child_process.js:810:5)
Update:
Here's what I have so far:
USER variables:
name: PATH
variable:
C:\Users\Jaime\AppData\Roaming\npm; C:\Program
Files\Java\jdk1.8.0_25\bin;
C:\Development\AndroidSDK\sdk\platform-tools;
C:\Development\AndroidSDK\sdk\tools;
C:\Development\AndroidSDK\sdk\build-tools; C:\Development\ApacheAnt\bin;
C:\Program Files\nodejs;
%PATH%;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools
SYSTEM variables:
name: ANDROID
variable: C:\Development\AndroidSDK\sdk
name: ANT
variable: C:\Development\ApacheAnt
name: JAVA
variable: C:\Program Files\Java\jdk1.8.0_25
Phonegap and cordova installation procedures
what are the need for installiation?
1)node js
download:http://nodejs.org/download/
We have node-v0.10.29-x64.msi (64 bit) installation. After install, open command prompt & type "node -v" , then "npm -v", these 2 commands should work without any error in command prompt.
Open command prompt - (Click windows and R keynd then enter the cmd)
2)phonegap
http://phonegap.com/install/
Install phonegap on cmd: enter npm install -g phonegap on cmd
After installation, files will be placed in C:\Users\Hari\AppData\Roaming\npm folder. You can check the installation by typing the command "phonegap -v" in command prompt.
3)java jdk
http://www.oracle.com/technetwork/java/javase/downloads/index.html?ssSourceSiteId=otnjp
We have jdk-8u5-windows-x64.exe file.
You may need to add path variables in My computer-->Right click-->Properties-->Advanced system settigs-->Environment variables
After install, check "java -version" in command prompt. "where java" will help you to identify the installation path of the java.
4)ant
download:http://ant.apache.org/
We already have apache-ant-1.9.4-bin.zip portable edition of Ant, We need not to install, just need to extract the zip file & place it in some secure place.
You may need to add path variables in My computer-->Right click-->Properties-->Advanced system settigs-->Environment variables
Environment variables name:Ant_Home
Ex: C:\Program Files\apache-ant-1.9.4
5)android sdk
download:http://developer.android.com/sdk/index.html
We have adt-bundle-windows-x86_64-20140624/SDK Manager.exe file.
6)ionic
cmd-->npm install -g ionic
7)cordova
cmd-->npm install -g cordova
PATH SETTING
My computer-->Right click-->Properties-->Advanced system settigs-->Environment variables
Edit the Path and give the like this
C:\Users\prabhu\AppData\Roaming\npm;C:\Program Files\apache-ant-1.9.4\bin;C:\phonegap_project\adt-bundle-windows-x86_64-20131030\sdk\tools;C:\phonegap_project\adt-bundle-windows-x86_64-20131030\sdk\build-tools;C:\Program Files\Java\jdk1.8.0_05\bin;
if Not Run JVM
Set systems variables
Click New
variable Name:_JAVA_OPTIONS
variable value:-Xmx512M

Categories

Resources