you probably used "sudo" to add the Android platform. A quick fix to this problem:
Restore access rights to all folders / subfolders in the platforms folder
Remove Android platform with sudo cordova platform remove android
Add the android platform with cordova platform add android DO NOT USE THE COURT! If there are errors without Sudo SO, then the problem! NEVER use the sudo thing, otherwise the project will have the same problem!
If you still have a problem, you can install the cord using sudo, there is also a solution for it:
we must first configure npm for global installation so that we can use it without sudo, the preferred way to enable npm to install packages around the world without exiting $ HOME is to set the local node prefix. It is as simple as running:
echo prefix = ~/.node >> ~/.npmrc echo 'export PATH=$HOME/.node/bin:$PATH' >> ~/.bashrc . ~/.bashrc
then run:
npm install -g cordova
this may result in:
Error: EACCES, permission denied '/home/yourusername/.config/configstore/update-notifier-cordova.json'
To fix this:
sudo chown yourusername:yourusername /home/yourusername/.config/configstore/update-notifier-cordova.json
After that, you can happily run npm install -g cordova without sudo without running into permission conflicts, and if something is completely broken and you want to start from scratch, all you have to do is delete the ~ / .node directory.
Hope this help!
you can also look at these two links: source 1 & 2
source share