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
Related
I'm trying to build an Ionic 2 app with push notification in iOS.
I added Phonegap plugin push notification with this command line :
cordova plugin add phonegap-plugin-push --variable SENDER_ID=12341234 --save
But when I try to run my project in a device I have this error in xcode :
"GoogleCloudMessaging.h" file not found
I looked for a solution and I had install Cocoapods. I removed platform iOS and I try to add it with this command line :
sudo ionic platform add ios
I had this error :
Installing "phonegap-plugin-push" for ios
Failed to install 'phonegap-plugin-push':undefined
Error: /Library/Ruby/Gems/2.0.0/gems/claide-1.0.2/lib/claide/command.rb:439:in `help!': [!] You cannot run CocoaPods as root. (CLAide::Help)
Usage:
$ pod COMMAND
CocoaPods, the Cocoa library package manager.
Commands:
+ cache Manipulate the CocoaPods cache
+ env Display pod environment
+ init Generate a Podfile for the current directory
+ install Install project dependencies according to versions from a
Podfile.lock
+ ipc Inter-process communication
+ lib Develop pods
+ list List pods
+ outdated Show outdated project dependencies
+ repo Manage spec-repositories
+ setup Setup the CocoaPods environment
+ spec Manage pod specs
+ update Update outdated project dependencies and create new Podfile.lock
Options:
--silent Show nothing
--version Show the version of the tool
--verbose Show more debugging information
--no-ansi Show output without ANSI codes
--help Show help banner of specified command
from /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.2.1/lib/cocoapods/command.rb:47:in `run'
from /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.2.1/bin/pod:55:in `<top (required)>'
from /usr/local/bin/pod:23:in `load'
from /usr/local/bin/pod:23:in `<main>'
I tried to run "pod install" directly in platforms/ios folder, but same issue.
So I try to remove sudo in the commande :
ionic platform add ios
But obviously I have this error :
MacBook-Air-de-user:MyApp compagny$ ionic platform add ios
Error during untar for /Users/user/.cordova/lib/npm_cache/cordova-ios/4.3.1/package.tgz: Error: EACCES: permission denied, open '/Users/user/.cordova/lib/npm_cache/cordova-ios/4.3.1/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/.cordova/lib/npm_cache/cordova-ios/4.3.1/package/package.json'
I really don't know what I have to do to solve that. An Idea ?
Try update Cordova version, remove platforms and add again:
npm install -g cordova
cordova platform remove android
cordova platform remove ios
cordova platform add android
cordova platform add ios
cordova plugin add phonegap-plugin-push --save
I had the same problem and its worked for me.
If anyone is still having issues, I got it to work by running
pod install
in platforms/ios
and you may need to add permissions in that folder before that
sudo chown -R *username* platforms/ios
To allow code executions on your mac without using sudo simply run.
sudo chown -R Username /Users/username/Document/project location
It's working for me
If you use any plugin and platform add please install and add without
"sudo".
If needed permission them go to the project directory and click
setting->Get Info to give "Read & Write" permission then you can install plugin and platform without "sudo"
ionic cordova plugin add cordova-plugin-fcm-with-dependecy-updated#7.5.0
ionic cordova build ios --prod
I am new with ionic framework.Currently i am working on ionic iOS app. when i install phonegap-plugin-push i am getting error
Failed to install 'phonegap-plugin-push':undefined Error: /Library/Ruby/Gems/2.0.0/gems/claide-1.0.1/lib/claide/command.rb:439:in `help!': [!] You cannot run CocoaPods as root. (CLAide::Help)
i have searched it but no solution found yet!
I also got same kind of problem. In my case I used sudo ionic platform add ios
This is worked well while building every plugins but phonegap-plugin-push.
phonegap-plugin-push is keep giving above error [!] You cannot run CocoaPods as root. (CLAide::Help)
Then I used ionic platform add ios without sudo This is the actual solution for this. But in this case It is keep giving me the permission related issue code EACCESS.
Then I used followings step to overcome that one.
sudo chown -R $USER /usr/local/
Again added cordoava and ionic
sudo npm install -g cordova
sudo npm install -g ionic
Other informations
phonegap-plugin-push version: 1.10.0
Cordova CLI: 6.5.0
Ionic CLI Version: 2.2.2
Node Version: v7.7.2
Xocde Version: Xcode 8.2.1
CocoaPods Version: 1.2.0
Hope this will help.
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
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.