Error: EACCES: permission denied


each time I run this command:
ionic serve
I got this error, is it related to VisualCode? or ionic?.
even if I run
sudo ionic serve
it works, but when I change something in .html files and save the changes, it doesn’t reflect in the browser !, I have to rerun the command again!, but when I change something in .scss it shows the changes in the browser directly !!!

ionic info:

cli packages: (/Users/AsimNet/ProjectWish/Wish/node_modules)

    @ionic/cli-plugin-cordova       : 1.6.2
    @ionic/cli-plugin-gulp          : 1.1.1
    @ionic/cli-plugin-ionic-angular : 1.4.1
    @ionic/cli-utils                : 1.7.0
    ionic (Ionic CLI)               : 3.7.0

global packages:

    Cordova CLI : 7.0.1
    Gulp CLI    : CLI version 1.3.0 Local version 3.9.1

local packages:

    @ionic/app-scripts : 2.1.3
    Cordova Platforms  : android 6.2.2 browser 4.1.0 ios 4.4.0
    Ionic Framework    : ionic-angular 3.6.0


    Node       : v8.2.1
    OS         : macOS Sierra
    Xcode      : Xcode 8.0 Build version 8A218a
    ios-deploy : 1.9.0
    ios-sim    : 5.0.13
    npm        : 5.3.0

Your file permissions are messed up somewhere. In the best case you shouldn’t need any sudo anywhere for development with Ionic.

To really fix this, uninstall your node and install nvm (or nvm-windows if on Windows) and reinstall node, then Ionic and Cordova. You might have to create a new project as well if your current project’s file permissions are really borked.

1 Like

I solved it by reinstalling ionic-cli