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
Related
Getting the following error and not 100% sure why. Currently getting this issue when I run my app in ios simulator
I've tried to do npm install watchman, But I just saw the latest update on the npm packages and it seems like it's been depreciated.
events.js:292
throw er; // Unhandled 'error' event
^
Error: EMFILE: too many open files, watch
at FSEvent.FSWatcher._handle.onchange (internal/fs/watchers.js:127:28)
Emitted 'error' event on NodeWatcher instance at:
at NodeWatcher.checkedEmitError
at FSWatcher.emit (events.js:315:20)
at FSEvent.FSWatcher._handle.onchange (internal/fs/watchers.js:133:12) {
errno: -24,
syscall: 'watch',
code: 'EMFILE',
filename: null
}
This error was caused by watchman.
You should run brew install watchman in the terminal.
If watchman fails to install, you should change the ownership of these directories to your user by
sudo chown -R $(whoami) /usr/local/etc/bash_completion.d /usr/local/lib/pkgconfig /usr/local/var/log
please refer to the tips in your terminal.
Finally you run brew install watchman. The problem should be solved.
For people with Mac M1 who are running into this problem, I tried the above brew install and upgrade watchman but they didnt work. My specific problem was that react-native project would build on the simulator fine through 'npm run ios' but when archiving or building through xcode I would get this error. After hours upon hours this is what did:
Go into your Security in your System Preferences of your Mac and give full disk access to watchman
The project you are building for some reason (Probably because Apple restricts access) does not work when in your Desktop or your Documents location. Once I moved it to under /Users/myname/ it finally built and archived in xcode.
Hopefully this will save someone else the 6 hours I spent debugging and trying to figure out this.
EDIT: THIS BROKE AGAIN SO HAD TO FOLLOW THIS NEXT TO FIX IT:
This error is because of a bug in module fsevents for mac m1 silicon. See the thread: https://github.com/facebook/metro/issues/668
It got fixed with new version of watchman. Upgrade your watchman through brew. Delete your project and download from git and rebuild everything along with pod install and then it should archive no problem.
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
I have to add iOS platform in ionic but I get permission error. (EACCES: permission denied, open '/Users/macbookpro/.config/configstore/insight-cordova.json' You don't have access to this file.)
I have followed some steps regarding NPM but not got any solution.
Just try changing permissions of the file insight-cordova.json by below command:
sudo chmod -R 777 '/Users/macbookpro/.config/configstore/insight-cordova.json'
And this should fix the problem.
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.