Cordova corrupt ios platform - ios

I am trying to add some ionic native elements e.g. 'ionic cordova plugin add cordova-plugin-camera' but i get a err due to the ios platform not being there.
running cordova platform version ios I get:
Installed platforms:
android 6.3.0
ios
Available platforms:
blackberry10 ~3.8.0 (deprecated)
browser ~5.0.0
ios ~4.5.1
osx ~4.0.1
ubuntu ~4.3.4 (deprecated)
webos ~3.7.0
windows ~5.0.0
www ^3.12.0
So I have ios installed however do deal with this problem i've run cordova platform rm ios
then cordova platform add ios but I get this error:
Using cordova-fetch for cordova-ios#0.0.1
Error: Failed to fetch platform cordova-ios#0.0.1
Probably this is either a connection problem, or platform spec is incorrect.
Check your connection and platform name/version/URL.
Error: npm: Command failed with exit code 1 Error output:
npm ERR! code ETARGET
npm ERR! notarget No matching version found for cordova-ios#0.0.1
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/adamgoldberg/.npm/_logs/2017-12-19T10_09_11_709Z-debug.log
I assume this has something to do with the ios platform not having a version associated with it but I can't figure it out.
ionic -v
3.19.0
PART 2 UPDATE
the first step results in:
rm: could not remove file (code EACCES): /Users/adamgoldberg/Documents/programming/thrive/platforms/ios/cordova/node_modules/ios-sim/node_mod
ules/.bin/nopt
rm: could not remove file (code EACCES): /Users/adamgoldberg/Documents/programming/thrive/platforms/ios/cordova/node_modules/ios-sim/node_mod
ules/.bin/shjs
rm: could not remove directory (code EACCES): /Users/adamgoldberg/Documents/programming/thrive/platforms/ios/cordova/node_modules/ios-sim/nod
e_modules/.bin
rm: could not remove directory (code EACCES): /Users/adamgoldberg/Documents/programming/thrive/platforms/ios/cordova/node_modules/ios-sim/nod
e_modules/bplist-parser
rm: could not remove directory (code EACCES): /Users/adamgoldberg/Documents/programming/thrive/platforms/ios/cordova/node_modules/ios-sim/nod
e_modules/nopt
rm: could not remove directory (code EACCES): /Users/adamgoldberg/Documents/programming/thrive/platforms/ios/cordova/node_modules/ios-sim/nod
e_modules/shelljs
rm: could not remove directory (code EACCES): /Users/adamgoldberg/Documents/programming/thrive/platforms/ios/cordova/node_modules/ios-sim/nod
e_modules/simctl
rm: could not remove directory (code ENOTEMPTY): /Users/adamgoldberg/Documents/programming/thrive/platforms/ios/cordova/node_modules/ios-sim/
node_modules
rm: could not remove directory (code ENOTEMPTY): /Users/adamgoldberg/Documents/programming/thrive/platforms/ios/cordova/node_modules/ios-sim
rm: could not remove directory (code ENOTEMPTY): /Users/adamgoldberg/Documents/programming/thrive/platforms/ios/cordova/node_modules
rm: could not remove directory (code ENOTEMPTY): /Users/adamgoldberg/Documents/programming/thrive/platforms/ios/cordova
rm: could not remove directory (code ENOTEMPTY): /Users/adamgoldberg/Documents/programming/thrive/platforms/ios
and then the second line ionic cordova platform add ios#latest results in
Using cordova-fetch for cordova-ios#latest
Error: Platform ios already added.
[ERROR] Exception:
PART 3 (running npm update -g)
npm ERR! path /usr/local/lib/node_modules/npm/node_modules/abbrev
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules/npm/node_modules/abbrev'
npm ERR! { Error: EACCES: permission denied, access '/usr/local/lib/node_modules/npm/node_modules/abbrev'
npm ERR! stack: 'Error: EACCES: permission denied, access \'/usr/local/lib/node_modules/npm/node_modules/abbrev\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules/npm/node_modules/abbrev' }žnpm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/adamgoldberg/.npm/_logs/2017-12-19T21_54_39_809Z-debug.log

Remove ios platform
cordova platform rm ios
Add platform via
ionic cordova platform add ios#latest
Add cordova-plugin-camera plugin
ionic cordova plugin add cordova-plugin-camera --force
Update 2:
Try with "sudo cordova platform rm ios" ,
Then remove "ios" platform from "config.xml" file if exits,
Then remove "ios" folder from physical path as well if exits,
After above three steps
ionic cordova platform add ios#latest
ionic cordova plugin add cordova-plugin-camera --force
If you will get same error(EACCES) again then try all command with "sudo"

Related

npm install PATH for postinstall scripts on Jenkins

My JS project uses a NPM package called commitizen:
https://github.com/commitizen/cz-cli
commitizen is added to my devDependencies in package.json file.
commitizen uses internally a package called opencollective as you can see here: https://github.com/commitizen/cz-cli/blob/master/package.json
commitizen on postinstall hook is calling opencollective postinstall which is supposed to run opencollective package binary.
Locally I've no problems running the postinstall hook, however, when I build my project on my Jenkins CI box I get this error when it runs the postinstall hook of commitizen package
sh: 1: opencollective: not found
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.4 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! commitizen#2.10.1 postinstall: `opencollective postinstall`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the commitizen#2.10.1 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
I tried to add node_modules/opencollective/dist/bin dir to the PATH but with no luck, I think because the opencollective alias is defined in opencollective package.json
Any idea about how to be able to run opencollective command without installing globally opencollective package?
Thank you!

Ionic - app hangs on splash screen

My ionic app is hanging on the splash screen - it was working fine and then I added some code, and went to test, and it's getting stuck.
It gets to this point:
------ Debug phase ------
Starting debug of 2e5ac6066864be48322a757c4d0ccdfde52cf356 (N51AP, iPhone 5s (GSM), iphoneos, arm64) a.k.a. 'Eamon White’s iPhone' connected through USB...
[ 0%] Looking up developer disk image
[ 90%] Mounting developer disk image
[ 95%] Developer disk image already mounted
[100%] Connecting to remote debug server
-------------------------
(lldb) command source -s 0 '/tmp/2F06F4BB-A7E5-4B97-87EC-A01CBEE5661A/fruitstrap-lldb-prep-cmds-2e5ac6066864be48322a757c4d0ccdfde52cf356'
Executing commands in '/tmp/2F06F4BB-A7E5-4B97-87EC-A01CBEE5661A/fruitstrap-lldb-prep-cmds-2e5ac6066864be48322a757c4d0ccdfde52cf356'.
(lldb) platform select remote-ios --sysroot '/Users/eamonwhite/Library/Developer/Xcode/iOS DeviceSupport/10.3.3 (14G60)/Symbols'
Platform: remote-ios
Connected: no
SDK Path: "/Users/eamonwhite/Library/Developer/Xcode/iOS DeviceSupport/10.3.3 (14G60)/Symbols"
(lldb) target create "/Users/eamonwhite/ionicmane/myapp/platforms/ios/build/device/myApp.app"
Current executable set to '/Users/eamonwhite/ionicmane/myapp/platforms/ios/build/device/myApp.app' (arm64).
(lldb) script fruitstrap_device_app="/private/var/containers/Bundle/Application/5EBCC0EF-FDB9-4DE7-A961-D91B6139AEA0/myApp.app"
(lldb) script fruitstrap_connect_url="connect://127.0.0.1:50188"
(lldb) target modules search-paths add /usr "/Users/eamonwhite/Library/Developer/Xcode/iOS DeviceSupport/10.3.3 (14G60)/Symbols/usr" /System "/Users/eamonwhite/Library/Developer/Xcode/iOS DeviceSupport/10.3.3 (14G60)/Symbols/System" "/private/var/containers/Bundle/Application/5EBCC0EF-FDB9-4DE7-A961-D91B6139AEA0" "/Users/eamonwhite/ionicmane/myapp/platforms/ios/build/device" "/var/containers/Bundle/Application/5EBCC0EF-FDB9-4DE7-A961-D91B6139AEA0" "/Users/eamonwhite/ionicmane/myapp/platforms/ios/build/device" /Developer "/Users/eamonwhite/Library/Developer/Xcode/iOS DeviceSupport/10.3.3 (14G60)/Symbols/Developer"
(lldb) command script import "/tmp/2F06F4BB-A7E5-4B97-87EC-A01CBEE5661A/fruitstrap_2e5ac6066864be48322a757c4d0ccdfde52cf356.py"
(lldb) command script add -f fruitstrap_2e5ac6066864be48322a757c4d0ccdfde52cf356.connect_command connect
(lldb) command script add -s asynchronous -f fruitstrap_2e5ac6066864be48322a757c4d0ccdfde52cf356.run_command run
(lldb) command script add -s asynchronous -f fruitstrap_2e5ac6066864be48322a757c4d0ccdfde52cf356.autoexit_command autoexit
(lldb) command script add -s asynchronous -f fruitstrap_2e5ac6066864be48322a757c4d0ccdfde52cf356.safequit_command safequit
(lldb) connect
(lldb) run
success
(lldb) safequit
Process 7681 detached
The deviceready message never comes.
One thing I did that is kind of relevant is, when I was building or something ionic asked me to upgrade ios-deploy from 1.9.1 to 1.9.2. I think this started happening after I did that. I try to revert back to 1.9.1 but it won't let me:
ld: framework not found MobileDevice
clang: error: linker command failed with exit code 1 (use -v to see invocation)
** BUILD FAILED **
The following build commands failed:
Ld build/Release/ios-deploy normal x86_64
(1 failure)
npm ERR! Darwin 17.0.0
npm ERR! argv "/usr/local/Cellar/node/7.7.3/bin/node" "/usr/local/bin/npm" "install" "-g" "ios-deploy#1.9.1"
npm ERR! node v7.7.3
npm ERR! npm v4.1.2
npm ERR! code ELIFECYCLE
npm ERR! ios-deploy#1.9.1 preinstall: `./src/scripts/check_reqs.js && xcodebuild`
npm ERR! Exit status 65
npm ERR!
npm ERR! Failed at the ios-deploy#1.9.1 preinstall script './src/scripts/check_reqs.js && xcodebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the ios-deploy package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! ./src/scripts/check_reqs.js && xcodebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs ios-deploy
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls ios-deploy
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/eamonwhite/Downloads/ionicmane-master/npm-debug.log
That might not be the problem. I could really use some help I'm close to a deadline.
UPDATE
When I try to run in xcode the same thing happens, but xcode gives these errors:
2017-10-10 15:49:17.417901-0400 myApp[8476:3520766] Resetting plugins due to page load.
2017-10-10 15:49:38.433127-0400 myApp[8476:3520766] Failed to load webpage with error: The request timed out.
UPDATE
I figured out what was causing this - it's livereload - if I run it without that its fine...but I kind of need it to work to develop.
I didn't have my wifi enabled on my phone so it couldn't connect to ionic.
From my experience we have the same issue deviceready is never shown in our console log, the most possible case would be inconsistency of the Cordova Plugin one thing that you could do is to reinstall the plugins and try to delete your platform folder and make a clean build with npm cache clean .
Update:
Based on your update , how are you running your ios app ?
Are you running your app using the -l -c commands like below:
ionic run ios -l -c
if that is the case you may be noticed that this command changes a line in the config.xml file:
// from
<content src="index.html"/>
// to
<content src="localhost//192.1.168.0:8000" original-src="index.html"/>
So Changing it back to <content src="index.html"/> might fixes the issue.
Solution 2:
You probably need to whitelist the localhost in the following way:
<allow-navigation href="http://localhost:8100/*"/>
My best guess is that your iPhone did not yet prepare the debugger for iOS11. It does so when running your app the first time on an new iOS version. You have to open and run your project once using XCode then you should be fine. Please also make sure you have the most recent version of cordova-ios which is 4.5.1 (check the <engine name=ios"> tag in your config.xml).
Check whether you have the following tag in your config.xml
<allow-navigation href="*"/>
Also can you check whether this is observed only in iOS or also in Android.
Ran into this with Ionic 4. After adding iOS platform, running the following worked:
ionic cordova prepare ios

"ionic cordova platform add ios" Failed to fetch platform cordova-ios#0.0.1

When I run "ionic cordova platform add ios", that got the following error. How to fix it?
Exception: Using cordova-fetch for cordova-ios#0.0.1
Error: Failed to fetch platform cordova-ios#0.0.1
Probably this is either a connection problem, or platform spec is incorrect.
Check your connection and platform name/version/URL.
Error: npm: Command failed with exit code 1 Error output:
npm ERR! code ETARGET
npm ERR! notarget No matching version found for cordova-ios#0.0.1
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/thanhnguyen/.npm/_logs/2017-08-25T10_34_19_961Z-debug.log
The following command should resolve the issue:
cordova platform add ios#latest
Inside my package.json there was a ios:0.0.1 which I removed and got resolved.

ionic build ios --release failed

I'm newer here and i would like a help from you. My english is not very well, but i'm trying to explain my issue.
When i run the ionic build ios --release on my ionic app, and the temrinal shows the below error:
ionic build ios --release
Running 'build:before' npm script before build
> ionic-hello-world# build /Users/allanbarbosa/Projetos/mobi-unidadedigital/v3
> ionic-app-scripts build
[15:37:26] ionic-app-scripts 0.0.28
[15:37:26] build prod started ...
[15:37:26] clean started ...
[15:37:27] clean finished in 62 ms
[15:37:27] copy started ...
[15:37:27] ngc started ...
[15:37:27] lint started ...
[15:37:27] copy finished in 593 ms
[15:37:32] lint finished in 5.18 s
[15:37:51] ngc error: Error: Error at /Users/allanbarbosa/Projetos/mobi-unidadedigital/v3/.tmp/pages/ConsultantChat/consultant-chat.ngfactory.ts:432:42: Property 'cleanFilter' does not exist on type 'ConsultantChat'.
Error at /Users/allanbarbosa/Projetos/mobi-unidadedigital/v3/.tmp/pages/Estatisticas/components/PointsResume/points-resume.ngfactory.ts:552:40: Property 'accordeon' is private and only accessible within class 'PointsResume'.
Error at /Users/allanbarbosa/Projetos/mobi-unidadedigital/v3/.tmp/pages/Estatisticas/components/PointsResume/points-resume.ngfactory.ts:557:40: Property 'animaAccordeon' is private and only accessible within class 'PointsResume'.
Error at /Users/allanbarbosa/Projetos/mobi-unidadedigital/v3/.tmp/pages/Estatisticas/components/PointsResume/points-resume.ngfactory.ts:562:40: Property 'accordeon' is private and only accessible within class 'PointsResume'.
Error at /Users/allanbarbosa/Projetos/mobi-unidadedigital/v3/.tmp/pages/Estatisticas/components/PointsResume/points-resume.ngfactory.ts:567:45: Property 'accordeon' is private and only accessible within class 'PointsResume'.
Error at /Users/allanbarbosa/Projetos/mobi-unidadedigital/v3/.tmp/pages/Estatisticas/estatistica.ngfactory.ts:552:42: Property 'ConsultantChat' does not exist on type 'EstatisticaPage'.
Error at /Users/allanbarbosa/Projetos/mobi-unidadedigital/v3/.tmp/pages/ModalAccount/modal-account.ngfactory.ts:325:29: Supplied parameters do not match any signature of call target.
at check (/Users/allanbarbosa/Projetos/mobi-unidadedigital/v3/node_modules/#angular/tsc-wrapped/src/tsc.js:31:15)
at Tsc.typeCheck (/Users/allanbarbosa/Projetos/mobi-unidadedigital/v3/node_modules/#angular/tsc-wrapped/src/tsc.js:86:9)
at /Users/allanbarbosa/Projetos/mobi-unidadedigital/v3/node_modules/#angular/tsc-wrapped/src/main.js:33:23
at process._tickCallback (internal/process/next_tick.js:103:7)
at Function.Module.runMain (module.js:577:11)
at startup (node.js:160:18)
at node.js:456:3
[15:37:51] ngc error: Compilation failed
[15:37:51] ngc failed: NGC encountered an error
[15:37:51] Error: NGC encountered an error
at ChildProcess.<anonymous> (/Users/allanbarbosa/Projetos/mobi-unidadedigital/v3/node_modules/#ionic/app-scripts/dist/ngc.js:60:24)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:852:16)
at Socket.<anonymous> (internal/child_process.js:323:11)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at Pipe._handle.close [as _onclose] (net.js:492:12)
Error running ionic app script "build": Error: NGC encountered an error
npm
ERR! Darwin 16.1.0
npm
ERR! argv "/usr/local/Cellar/node/6.2.1/bin/node" "/usr/local/bin/npm" "run" "build"
npm ERR!
node v6.2.1
npm ERR! npm v3.10.8
npm ERR! code ELIFECYCLE
npm ERR!
ionic-hello-world# build: `ionic-app-scripts build`
npm ERR!
Exit status 1
npm ERR!
npm ERR!
Failed at the ionic-hello-world# build script 'ionic-app-scripts build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the ionic-hello-world package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! ionic-app-scripts build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs ionic-hello-world
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls ionic-hello-world
npm
ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR!
/Users/allanbarbosa/Projetos/mobi-unidadedigital/v3/npm-debug.log
Caught exception:
undefined
I trying to search on my pages this ngc problems, but no successful. Someone can help me?
My ionic info
Your system information:
Cordova CLI: 6.4.0
Gulp version: CLI version 3.9.1
Gulp local:
Ionic Framework Version: 2.0.0-rc.0
Ionic CLI Version: 2.1.0
Ionic App Lib Version: 2.1.0-beta.1
ios-deploy version: 1.9.0
ios-sim version: 5.0.8
OS: Mac OS X El Capitan
Node Version: v6.2.1
Xcode version: Xcode 8.1 Build version 8B62

React Native iOS Deployment Error

The below error occurred while in attempt to deploy my app to the mobile phone for testing.
the app function in the Xcode Simulator, and was able to export to the app into iPhone for testing.
after running the npm start the following error occurred.
while the iPhone app did load but count not connect to development server due to not able to npm start.
And yes both the iPhone and my computer is on the same wireless network.
┌────────────────────────────────────────────────────────────────────────────┐
│ Running packager on port 8081. │
│ │
│ Keep this packager running while developing on any JS projects. Feel │
│ free to close this tab and run your own packager instance if you │
│ prefer. │
│ │
│ https://github.com/facebook/react-native │
│ │
└────────────────────────────────────────────────────────────────────────────┘
Looking for JS files in
/Users/jimmylin/dev/ga/WalkingTour/SohoDuck
[10:40:02 AM] <START> Building Dependency Graph
[10:40:02 AM] <START> Crawling File System
[Hot Module Replacement] Server listening on /hot
React packager ready.
ERROR: Unknown option --no-pretty
ERROR: Unknown option --no-pretty
Watchman: watchman--no-pretty get-sockname returned with exit code 1 ERROR: Unknown option --no-pretty
ERROR watchman--no-pretty get-sockname returned with exit code 1 ERROR: Unknown option --no-pretty
Error: watchman--no-pretty get-sockname returned with exit code 1 ERROR: Unknown option --no-pretty
at ChildProcess.<anonymous> (/Users/jimmylin/dev/ga/WalkingTour/SohoDuck/node_modules/fb-watchman/index.js:198:18)
at emitTwo (events.js:100:13)
at ChildProcess.emit (events.js:185:7)
at maybeClose (internal/child_process.js:850:16)
at Socket.<anonymous> (internal/child_process.js:323:11)
at emitOne (events.js:90:13)
at Socket.emit (events.js:182:7)
at Pipe._onclose (net.js:477:12)
See http://facebook.github.io/react-native/docs/troubleshooting.html
for common problems and solutions.
npm ERR! Darwin 15.3.0
npm ERR! argv "/usr/local/Cellar/node/5.9.1/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v5.9.1
npm ERR! npm v3.7.3
npm ERR! code ELIFECYCLE
npm ERR! SohoDuck#0.0.1 start: `node node_modules/react-native/local-cli/cli.js start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the SohoDuck#0.0.1 start script 'node node_modules/react-native/local-cli/cli.js start'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the SohoDuck package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node node_modules/react-native/local-cli/cli.js start
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs SohoDuck
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls SohoDuck
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/jimmylin/dev/ga/WalkingTour/SohoDuck/npm-debug.log
any suggestion would be greatly appreciated.
Correct installation of dependencies
Uninstall watchman and flow via npm and homebrew
Install watchman and flow only via homebrew
brew install watchman
brew install flow

Resources