On running the command
cordova emulate ios
I get an error, as below. I actually get rm: could not remove & permission denied errors so I use sudo. I was able to run this no problem, and then after a reboot - although nothing was changed - this function does not work. After build succeeded - deploying to emulator I get this error
An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=159):
Invalid device state
ENOENT: no such file or directory, stat '/Users/user/Library/Logs/CoreSimulator/8F3C9A0F-D432-49A4-84DA-D0480829884A/system.log'
Error code 1 for command: ios-sim with args: launch,/Users/user/helloworld/platforms/ios/build/emulator/helloworld.app,--devicetypeid,com.apple.CoreSimulator.SimDeviceType.iPhone-4s,--stderr,/Users/user/helloworld/platforms/ios/cordova/console.log,--stdout,/Users/user/helloworld/platforms/ios/cordova/console.log,--exit
Error: /Users/user/helloworld/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:139:23)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at maybeClose (internal/child_process.js:818:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
I have reinstalled sudo npm install ios-sim -g and same error. How can I run it properly?
This happens due to the permissions on mac:
Here are the steps you can use to correct this issue:
Empty the 'platforms' folder in your Cordova project.
Re-run Cordova platform add ios, Cordova build ios, and Cordova emulate ios without sudo.
If you are on a Mac and are still getting a permissions error, make sure all the files in your user's home folder actually belong to that user by running sudo chown -R username /Users/username
Its happening when you don't have simulator configurations for the root user.
Following command worked for me
sudo npm install -g ios-sim
If it's not working you can try removing platforms as the root user and add it back as normal user.
This happens because xcode command line tools are not installed in your system
https://github.com/driftyco/ionic/issues/4657.
Do a xcode-select --install from your terminal and reboot the system should work fine.
Related
I installed globaly cordova and already get the path when I type which cordova, it show cordova: aliased to /Users/myusername/lib/node_modules/cordova/bin
but when I type cordova create hello com.example.hello HelloWorld, it got response as zsh: permission denied: /Users/myusername/lib/node_modules/cordova/bin
then I tried type sudo chown -R myusername /Users/myusername/lib/node_modules/cordova/bin
but it got response as zsh: permission denied: /Users/myusername/lib/node_modules/cordova/bin when I type cordova create hello com.example.hello HelloWorld again.
how to repair it so I can create new ios cordova project from my angular app?
I type npm config set prefix /usr/local, and then after enter I type npm install -g cordova and enter again. the I can got cordova --version. It starting create new project when I type cordova create hello com.example.hello HelloWorld.
that is the solution for me. Hope this can help other.
After having the issue above when trying to install it globally, I tried locally and it worked. Simply type the following on Terminal:
npm install cordova
When I run 'cordova build ios' on an existing project I get a permissions error when accessing the projects ios folder.
Node has been installed using 'NVM' and when I run 'which cordova' and it gives me the correct path in the .nvm folder.
I'm also able to install npm packages without sudo and can run 'cordova build ios' on on other projects no problem.
Error printed in the terminal:
cordova-custom-config: Skipping auto-restore of config file backup(s)
Error: EACCES: permission denied, scandir '/Users/username/project/cordova/platforms/ios/build/device/libCordova.a'
The last resort I can think is removing the ios platform and adding again, but the last dev may have made some changes to these files so would like to avoid that if possible.
I got the same error but for many other files, all when running 'cordova build ios'. The files in question were all in the same folder, all owned by 'root'. I am pretty sure that I had previously and mistakenly run 'sudo cordova build ios', which would have generated the files initially.
I ran a 'sudo chown -R [me] [folder]' and got my build back.
I am using Mac OS Sierra v10.12 and getting error while adding to my Phonegap project within the folder myApp:
$ node -v
v7.2.0
$ npm -v
3.10.9
$ cordova platform add ios
received following errors:
Error during untar for /Users/{user_name}/.cordova/lib/npm_cache/cordova-ios/4.3.0/package.tgz: Error: EACCES: permission denied, open '/Users/{user_name}/.cordova/lib/npm_cache/cordova-ios/4.3.0/package/package.json'
Error: Failed to fetch platform ios
Probably this is either a connection problem, or platform spec is incorrect.
Check your connection and platform name/version/URL.
Error: EACCES: permission denied, open '/Users/{user_name}/.cordova/lib/npm_cache/cordova-ios/4.3.0/package/package.json'
Note: {user_name} is my mac user Id, Can anybody help me!
I think you have to issue with permission to add platform .
Try to following :
$sudo chown -R {user_name} /Users/{user_name}/.cordova/lib/npm_cache/
For more please check here.
Hopes this will help you !
Maybe this is a cache problem of cordova. Delete the cache and try to add the platform again:
rm -rf ~/.cordova
Try upgrading npm, this worked for me:
npm install npm#latest -g
I am following this guide: http://ionicframework.com/getting-started/
Once I get to ionic emulate ios I get
Error: ENOENT: no such file or directory, stat '/Users/$USERNAME/Library/Logs/CoreSimulator/DCB9BBDE-FFEC-43CD-B88E-FFFB6CBF0045/system.log'
I tried what other people did to solve their problem, like
chown your $HOME to yourself
remove platforms folder
remove XCode and install again
But none of this solved my problem.
I am on OSX El Capitan, using node v4.3.1 installed with nave (might this be an issue?).
I've tried with a fresh new project and got this
ENOENT: no such file or directory, stat '/Users/$USER/Library/Logs/CoreSimulator/FF5BE4A0-C42E-4C35-884F-21EFC514A846/system.log'
Error code 1 for command: ios-sim with args: launch,/Users/$USER/workspace/myApp/platforms/ios/build/emulator/myApp.app,--devicetypeid,com.apple.CoreSimulator.SimDeviceType.iPhone-6,--stderr,/Users/$USER/workspace/myApp/platforms/ios/cordova/console.log,--stdout,/Users/$USER/workspace/myApp/platforms/ios/cordova/console.log,--exit
Error: /Users/$USER/workspace/myApp/platforms/ios/cordova/run: Command failed with exit code 2
Thank you in advance
Hi please see my answer to the following question:
ionic emulate ios (domain=com.apple.CoreSimulator.SimError, code=163)
After this, I tried:
sudo chown -R $USER:$GROUP ~/.npm sudo chown -R $USER:$GROUP ~/.config
in terminal and was able to run the app in a simulator
I seriously need help in this area. This is my first time working with the iOS platform for apache cordova. I have already downloaded the latest Node.js tool and Apache Cordova on my macbook. The PATH is also set up already. I was following the Apache Cordova command line steps, and when I tried to run the following command:
cordova platform add ios
I received the following error message:
/Users/metanoiasherman/.cordova/lib/npm_cache/cordova-ios/3.7.0/package/bin/create: line 80: dirname: command not found
cat: /Users/metanoiasherman/DropPositioning/../CordovaLib/VERSION: No such file or directory
Error: /Users/metanoiasherman/.cordova/lib/npm_cache/cordova-ios/3.7.0/package/bin/create: Command failed with exit code 1
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:135:23)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1008:16)
at Process.ChildProcess._handle.onexit (child_process.js:1080:5)
This is what my $PATH prints out in Terminal:
/Users/metanoiasherman/./usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/lib/node_modules/cordova/bin/
Can anyone tell me what I need to do?
I have just downloaded the Xcode command line tools and installed it already. Do I have to restart my macbook? Can someone present me with the steps I need to take to solve this and progress on?
It might be an issue with your $PATH
Try to run
$PATH
from the terminal and check if that includes the same path stated when you run:
which cordova