I was updating NPM, Node, and Vue (a javascript framework). I think somewhere I changed the permissions to a directory to root root. I am trying to run
npm install -g @vue/cliI get a string of
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/@vue/The owner of node_modules was root:root and I changed it to root:staff. I also made sure I was in the staff group. For some reason I am still getting Missing write access. I also chmod 775 -R. And then reboot to make sure the new permissions loaded but still having trouble installing the Vue CLI. What am I doing wrong?
1 Answer
As describe on npm documentation you can:
- Back up your computer.
On the command line, in your home directory, create a directory for global installations:
mkdir ~/.npm-globalConfigure npm to use the new directory path:
npm config set prefix '~/.npm-global'In your preferred text editor, open or create a ~/.profile file and add this line:
export PATH=~/.npm-global/bin:$PATHOn the command line, update your system variables:
source ~/.profileTo test your new configuration, install a package globally without using sudo:
npm install -g jshint
Instead of steps 2-4, you can use the corresponding ENV variable (e.g. if you don’t want to modify ~/.profile):NPM_CONFIG_PREFIX=~/.npm-global