Error running 'ionic emulate ios' command - ios

I've installed and build ios and all seems ok but when I run 'ionic emulate ios' I get the following error (just running it for the demo myApp):
Updated the hooks directory to have execute permissions
Running command: /Users/X/myApp/hooks/after_prepare/010_add_platform_class.js /Users/X/myApp
add to body class: platform-ios
Running command: /Users/X/myApp/platforms/ios/cordova/run --emulator
/bin/sh: ios-sim: command not found
Error: /Users/X/myApp/platforms/ios/cordova/run: Command failed with exit code 2
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1015:16)
at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
Anyone have any ideas?

Did you installed ios-sim?
sudo npm install -g ios-sim
Fix the hooks error permission:
chmod +x hooks/after_prepare/*

First, it seems that you do not give 'execute permission' to cordova hooks, so just run:
chmod -R +x hooks/after_prepare
more about hooks issues: http://ionicframework.com/docs/ionic-cli-faq/#hooks.
Secondly, use ionic cli start ios simulator, you must install a utility package called ios-sim:
sudo npm install -g ios-sim
more about ios emulation:http://ionicframework.com/docs/ionic-cli-faq/#ios-emulate.
Hope this will help you. Regards.

Related

How to solve this build error on Linux when building libsodium

I'm trying to build libsodium-sys dependency in an Azure Docker VM which is based on debian.
Have spend a couple of hours trying to fix this build error, but can't figure out what's going on.
I fixed a couple of build errors by installing missing dependencies as the Azure Docker VM seems very vanilla. Executed commands are below the error.
error: failed to run custom build command for `libsodium-sys v0.2.6 (https://github.com/cjdelisle/sodiumoxide?rev=76dc0e6e587b8c8a4bb193ebba9f8ae8f090b81b#76dc0e6e)`
Caused by:
process didn't exit successfully: `/home/packetcrypt_rs/target/release/build/libsodium-sys-169018138a0de36b/build-script-build` (exit code: 101)
checking for working alloca.h... yes
checking for alloca... yes
...
Making check in builds
--- stderr
/bin/bash: line 20: cd: builds: No such file or directory
make: *** [Makefile:516: check-recursive] Error 1
thread 'main' panicked at '
Failed to build libsodium using "make" "check" "-j4"
', /root/.cargo/git/checkouts/sodiumoxide-9b8c3ad42446e2d9/76dc0e6/libsodium-sys/build.rs:281:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: build failed
root#2d0a725cde47:/home/packetcrypt_rs#
Build.rs file it's talking about: https://github.com/sodiumoxide/sodiumoxide/blob/master/libsodium-sys/build.rs
Executed commands:
apt get-update
apt-get install pkg-config
apt install apt-utils
apt install file
apt install gcc git
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
apt install make
apt install build-essential gcc-multilib -y
rustup target add armv7-unknown-linux-gnueabihf
git clone https://github.com/cjdelisle/packetcrypt_rs
cd packetcrypt_rs
~/.cargo/bin/cargo build --release
The cause seems related to the issue explained here: https://gitlab.com/gitlab-org/gitlab-runner/-/issues/1379#note_280986944
For reasons unbeknownst to me, these are the commands I needed to execute to fix it:
rm ~/.bashrc
rm ~/.profile

Ios-deploy install doesn't work - macOS High Sierra (10.13.5)

Command line arguments than I used for ios-deploy.
sudo npm install -g ios-deploy --unsafe-perm --allow-root
Expected behavior
Install ios-deploy global via NPM
Actual behavior.
Ios-deploy not installed and get the error 65:
/bin/sh -c /usr/local/lib/node_modules/ios-deploy/build/ios-deploy.build/Release/ios-deploy.build/Script-C0CD3D981F59D20100F954DB.sh
cp: /System/Library/PrivateFrameworks/MobileDevice.framework/XPCServices: No such file or directory
** BUILD FAILED **
The following build commands failed:
PhaseScriptExecution Run\ Script build/ios-deploy.build/Release/ios-deploy.build/Script-C0CD3D981F59D20100F954DB.sh
(1 failure)
npm ERR! code ELIFECYCLE
npm ERR! errno 65
npm ERR! ios-deploy#1.9.2 preinstall: ./src/scripts/check_reqs.js && xcodebuild
npm ERR! Exit status 65
npm ERR!
npm ERR! Failed at the ios-deploy#1.9.2 preinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/vinicius/.npm/_logs/2018-06-20T10_50_13_426Z-debug.log
Steps to reproduce the problem
I run the command: npm install -g ios-deploy
System Specs
system_profiler SPSoftwareDataType
System Version: macOS 10.13.5 (17F77)
Kernel Version: Darwin 17.6.0
Boot Volume: Macintosh HD
Boot Mode: Normal
Computer Name: Mac mini de Vinicius
User Name: Vinicius Ribeiro (vinicius)
Secure Virtual Memory: Enabled
System Integrity Protection: Enabled
Time since boot: 36 minutes
ios-deploy -V
-bash: ios-deploy: command not found
3. xcodebuild -version
Xcode 9.4.1
Build version 9F2000
4. xcode-select --print-path
/Applications/Xcode.app/Contents/Developer
gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 9.1.0 (clang-902.0.39.2)
Target: x86_64-apple-darwin17.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
lldb --version
lldb-902.0.79.7
Swift-4.1
Removed XPCServices file, and the install worked;
https://github.com/ios-control/ios-deploy/issues/346
I know very little about npm install, but I have found that when blocked from an installation on High Sierra, such as when updating ruby gems, a simple solution is to turn off SIP temporarily.

fabric-composer quick-start failed on ubuntu 16.04

I'm trying to follow the Fabric Composer Quickstart but failed.
Could you give me hints?
When I tried "sudo npm install", the script was completed with a few warnings.
npm WARN lifecycle getting-started#1.0.0~preinstall: cannot run in wd %s %s (wd=%s) getting-started#1.0.0 composer --version || echo 'Please first run npm install -g composer-cli' /<directory>/sample-applications/packages/getting-started
npm WARN lifecycle getting-started#1.0.0~install: cannot run in wd %s %s (wd=%s) getting-started#1.0.0 scripts/download-hyperledger.sh && scripts/start-hyperledger.sh && npm run deployNetwork /<directory>/sample-applications/packages/getting-started
When I tried "sudo composer network list -n digitalproperty-network --enrollId WebAppAdmin --enrollSecret DJY27pEnl16d",
List business network digitalproperty-network
2017-03-21T22:44:47.360Z ERROR FSConnectionProfileStore :load() Failed to loaded connection profile defaultProfile {"0":{"stack":["{Error}ENOENT: no such file or directory, open '<directory>.composer-connection-profiles/defaultProfile/connection.json' Error: ENOENT: no such file or directory, open '<directory>.composer-connection-profiles/defaultProfile/connection.json'"," at Error (native)"]}}$
Failed to load connection profile defaultProfile
Command completed successfully.
I use
Ubuntu: 16.04
docker: 1.13.1
docker-compose: 1.11.2
node: v6.10.0
npm: 4.4.4
git: 2.11.0
composer:
composer-cli v0.5.5
composer-admin v0.5.5
composer-client v0.5.5
composer-common v0.5.5
composer-runtime-hlf v0.5.5
composer-connector-hlf v0.5.5
It looks like I have .composer-connection-profiles/defaultProfile/ direcotry but the directory don't have connection.js
How can we solve the problem? can i prepare connection.js manually?
Thank you!
This problem occurs when you run the npm install using sudo.
it shouldn't be necessary to run the commands as root so try again without using sudo and see if that helps.
This solves the problem npm install composer-connector-hlf

Cordova Error code 65 for command: xcodebuild with args

i tried with some simple codes to build a task.
the steps like that:
cordova -d create hello com.example.hello HelloWorld
cd hello
cordova platform add ios
cordova build ios
and it threw error:
Create product structure
/bin/mkdir -p /Users/millet/hello/platforms/ios/build/emulator/HelloWorld.app
PhaseScriptExecution Copy\ www\ directory build/HelloWorld.build/Debug-iphonesimulator/HelloWorld.build/Script-304B58A110DAC018002A0835.sh
cd /Users/millet/hello/platforms/ios
/bin/sh -c /Users/millet/hello/platforms/ios/build/HelloWorld.build/Debug-iphonesimulator/HelloWorld.build/Script-304B58A110DAC018002A0835.sh
dyld: bad external relocation length
/Users/millet/hello/platforms/ios/build/HelloWorld.build/Debug-iphonesimulator/HelloWorld.build/Script-304B58A110DAC018002A0835.sh: line 2: 15137 Trace/BPT trap: 5 node cordova/lib/copy-www-build-step.js
Command /bin/sh failed with exit code 133
** BUILD FAILED **
The following build commands failed:
PhaseScriptExecution Copy\ www\ directory build/HelloWorld.build/Debug-iphonesimulator/HelloWorld.build/Script-304B58A110DAC018002A0835.sh
(1 failure)
Error: Error code 65 for command: xcodebuild with args: -xcconfig,/Users/millet/hello/platforms/ios/cordova/build-debug.xcconfig,-project,HelloWorld.xcodeproj,ARCHS=i386,-target,HelloWorld,-configuration,Debug,-sdk,iphonesimulator,build,VALID_ARCHS=i386,CONFIGURATION_BUILD_DIR=/Users/millet/hello/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/millet/hello/platforms/ios/build/sharedpch
my ios version is 4.1.1 and cordova version is 6.2.0 and xcode version is 7.2
I fixed by running following command:
chmod +x "[Path].sh"
Change Path to your path where showing in error messages

Cordova Build fails on OS X with EACCES & ENOENT

I recently started building iOS apps using Cordova and I’ve hit a roadblock. After installing nodeJS, git and cordova (with sudo), I created my first app in the Documents folder of my user account.
The first run went perfectly. Everything worked, and adding my dev account to Xcode helped my app to run on the device. I decided I’d spice things up a bit by adding a “before_prepare” hook called 001_c.js in <appName>/hooks/before_prepare folder. This is how the hook begins:
//This is where nodeJS exists
#!/usr/local/bin node
console.log("Changing config");
var fs = require('fs');
var path = require('path');
var rootdir = process.argv[2];
//and so on
When I now build the app, I get this error:
pc295786:master kellster$ cordova build ios Running command:
/Users/kellster/documents/apps/master/hooks/before_prepare/001_c.js
/Users/kellster/documents/apps/master Error: spawn EACCES
at exports._errnoException (util.js:746:11)
at ChildProcess.spawn (child_process.js:1155:11)
at Object.exports.spawn (child_process.js:988:9)
at Object.exports.spawn (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:104:31)
at runScriptViaChildProcessSpawn (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:188:23)
at runScript (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:131:16)
at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:114:20
at _fulfilled (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:787:54)
at self.promiseDispatch.done (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:816:30)
at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:749:13)
To troubleshoot, I changed the first line of the hook script from
#!/usr/local/bin node
to
#! node
(Because this worked on Windows. node was in global scope). But, this resulted in an ENOENT error:
pc295786:master kellster $ cordova build ios Running command:
/Users/kellster/documents/apps/master/hooks/before_prepare/001_c.js
/Users/kellster/documents/apps/master Error: Hook failed with error
code ENOENT:
/Users/kellster/documents/apps/master/hooks/before_prepare/001_c.js
at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:194:23
at _rejected (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:797:24)
at /usr/local/lib/node_modules/cordova/node_modules/q/q.js:823:30
at Promise.when (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:1035:31)
at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:741:41)
at /usr/local/lib/node_modules/cordova/node_modules/q/q.js:557:44
at flush (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:108:17)
at process._tickCallback (node.js:355:11)
at Function.Module.runMain (module.js:503:11)
at startup (node.js:129:16)
How do I get this to build? I’d appreciate any suggestions I could try.
Some things to note:
(In my desperation, ) I tried running the following commands, because the "EACCES" type of error. But none of them seemed to have any kind of effect on the result. The build was still failing.
sudo chmod 777 “/Users/kellster/documents/apps/master"
sudo chmod 777 “/usr/local/lib”
sudo chmod 777 "/usr/local/bin/"
chmod 777 "/Users/kellster/documents/apps/master/platforms/"
sudo chmod a+rwx "/Users/kellster/Documents/apps/Master/hooks/before_prepare/001_c.js"
sudo chmod a+rwx "/Users/kellster/Documents/apps/Master/"
sudo chown -R kellster /usr/local/lib/node_modules/cordova
2) Node is installed in
/usr/local/bin
Old answer: #!/usr/local/bin node -> better #!/usr/bin/env node
Updated answer: do not use spaces for referencing node executable instead use:
#!/usr/local/bin/node
Also chmod your script: For example:
chmod 777 hooks/before_prepare/onde.js
where onde.js it is your script. If you're on Mac(my case) or Linux, then your .js must on chmod 777 to avoid EACCES errors.

Resources