permission denied while trying to install vue/cli

You don't have enough permissions. Try with sudo:

sudo npm i -g @vue/cli


You need to have permission by writing sudo at the first of your command

sudo npm i  @vue/cli -g

Updated

Or as Philip said it would be better than my answer

  1. Create a directory in your home directory, say ~/.npm-global.

  2. run npm config set prefix ~/.npm-global

  3. Update your PATH: export PATH=~/.npm-global/bin:$PATH


It seem's that you do not have the required privileges to install globally. You could either try installing with sudo or (recommended) move NPM's default directory to one which you have read/write permissions on:

  1. Create directory in your home directory, say ~/.npm-global.

  2. run npm config set prefix '~/.npm-global'

  3. Update your PATH: export PATH=~/.npm-global/bin:$PATH

https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally

Notice that while you could probably just use sudo, this is highly discouraged. It even says so in the error output you posted:

npm ERR! permissions of the file and its containing directories, or try running

npm ERR! the command again as root/Administrator (though this is not recommended).