Cordova version error while using ionic to create

2019-02-18 22:22发布

问题:

I got the following error while creating a new app using ionic. I am following instructions according to the standard doc (http://ionicframework.com/getting-started/)

gsakhardande@gsakhardande-PC:~/Desktop$ ionic start myApp blank

Creating Ionic app in folder /home/gsakhardande/Desktop/myApp based on blank project

Downloading: https://github.com/driftyco/ionic-app-base/archive/master.zip [=============================] 100% 0.0s

Downloading: https://github.com/driftyco/ionic-starter-blank/archive/master.zip [=============================] 100% 0.0s

Update config.xml

Initializing cordova project.

Fetching plugin "org.apache.cordova.device" via plugin registry

Error: EACCES, mkdir '/home/gsakhardande/tmp/npm-18818-6xrPvo-8'

Unable to add plugins. Perhaps your version of Cordova is too old. Try updating (npm install -g cordova), removing this project folder, and trying again.

回答1:

Running Command With sudo

sudo ionic start todo blank


回答2:

The error-line at the last seems to be a default error message in ionic and working with cordova. The solution is as simple as running the command with sudo.



回答3:

Something may have changed regarding the installation of newer Ionic/Cordova versions via Node/NPM, as reiterated in this Cordova bug tracker issue thread.

As @TechSpellBound suggests, you could prefix all ionic command line calls with 'sudo'. I took some alternative advice from the bug tracker post and simply changed the owner and group of the 'tmp' folder to my own user/group and not 'root:root', as it seemed to be, previously:

sudo chown -R someuser:somegroup /home/someuser/tmp

My group name was the same as my user name, so, assuming a similar setup on your machine, issue:

sudo chown -R gsakhardande:gsakhardande /home/gsakhardande/tmp

;-)