ionic update-notifier-cordova.json' You don

2020-05-25 06:41发布

问题:

I am trying to run ionic on iOS, but it throws an error.

What happened?

ionic run ios
    /usr/local/lib/node_modules/cordova/node_modules/update-notifier/node_modules/configstore/index.js:53
                    throw err;
                          ^
    Error: EACCES, permission denied '/Users/jiahongl/.config/configstore/update-notifier-cordova.json'
    You don't have access to this file.

        at Error (native)
        at Object.fs.openSync (fs.js:500:18)
        at Object.fs.readFileSync (fs.js:352:15)
        at Object.create.all.get (/usr/local/lib/node_modules/cordova/node_modules/update-notifier/node_modules/configstore/index.js:34:26)
        at Object.Configstore (/usr/local/lib/node_modules/cordova/node_modules/update-notifier/node_modules/configstore/index.js:27:44)
        at new UpdateNotifier (/usr/local/lib/node_modules/cordova/node_modules/update-notifier/index.js:34:17)
        at module.exports (/usr/local/lib/node_modules/cordova/node_modules/update-notifier/index.js:123:23)
        at checkForUpdates (/usr/local/lib/node_modules/cordova/src/cli.js:64:20)
        at cli (/usr/local/lib/node_modules/cordova/src/cli.js:114:5)
        at Object.<anonymous> (/usr/local/lib/node_modules/cordova/bin/cordova:41:1)

Error Message

回答1:

I just changed permission of the file update-notifier-cordova.json by below command:

sudo chmod -R 777 '/Users/anand.d.gupta/.config/configstore/update-notifier-cordova.json'

And this fixed the problem.



回答2:

delete the file update-notifier-cordova.json from this location problem solved, it's nothing but just a config file



回答3:

Deleting the file wont be a right option, the following approach worked out for me. The root cause of this issue is because of the Cordova-cli permissions.

Step 1: Uninstallcordova and install it again.

 sudo npm remove -g cordova 

Step 2: Install with the following command

sudo npm install -g --unsafe-perm=true cordova

Make sure it installs the recent version, by typing $ ionic info you can see the Cordova CLI versions

Step 3: Secure the permissions for the following folders

sudo chown -R <username> /Users/<username>/.config/configstore/
sudo chown -R <username> /Users/<username>/.cordova/

ionic build ios  - Should work like charm


回答4:

In my project, this problem has been fixed with this lines:

sudo chown -R $USER:$GROUP ~/.npm
sudo chown -R $USER:$GROUP ~/.config


回答5:

changed permission to this folder

sudo chown -R yourusername /Users/yourusername/.config/configstore/