Vue CLI Installation Fails on macOS Mojave 10.14

vue-cli

#1

Hello,

I have tried repeatedly to install Vue CLI 3 on two separate Macs, both running the new macOS Mojave 10.14, and it always fails, indicating a permissions error related to the node_modules folder. I checked the folder for permissions and gave it full read/write/delete permissions, and it still did not work. I then tried deleting the folder, it still did not work.

I have node.js v8.12.0 and npm v6.4.1 installed, so it should work. Once I confirmed the correct versions were installed, I ran the Vue CLI installation command and got this message:

npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR!  { Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR!   stack: 'Error: EACCES: permission denied, access \'/usr/local/lib/node_modules\'',
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/local/lib/node_modules' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
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).

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/myusername/.npm/_logs/2018-10-11T23_06_02_766Z-debug.log```

Has anyone else experienced this? Am I doing something wrong?
Any help would be very greatly appreciated.

#2

I think NPM doesn’t have enough permissions


#3

Additionally, I am the only user and admin on both computers. I even tried running it as SUDO (I know this is not recommended), and it still failed.

Has anyone successfully installed Vue CLI on the new macOS Mojave?


#4

I have now tried installation on a clean Linux Ubuntu installation of v18.04 (the latest), and it produces the same exact error.

I’m very confused now. Not sure what I could possibly be doing wrong with a clean install?


#5

did you try and do the install using sudo?


#6

He said yes.


#7

This morning I tried running the following command on the Linux machine:

sudo npm install -g @vue/cli

And it worked! However, this did not work on my 2 Macs for some reason, and still produces the same permissions error? Is it possible Apple changed some permission issue internally and it caused a conflict with Vue CLI 3?


#8

have you tried installing any other module globally, like http-server or knex ?

If it’s a general permission problem when trying to install global modules, those should fail as well.


#9

Thank LinusBorg. I just tried installing http-server and it produced the exact same initial error, indicating a permissions problem with the node_modules folder.


#10

I’m not sure what else to I can try at this point. Maybe reinstall my entire OS and start from scratch? It’s extremely weird this same problem is happening on both my Macs, after following the installation procedure precisely. I’ve never messed with any permissions on my folders before. Maybe it’s a conflict between Node and the new macOS Mojave?


#11

Or you can try installing node with it: n-install


#12

So after playing around with it all night, and reading a lot of info, I found that it was indeed a permissions error related to NPM. I found a page on the NPM site describing permissions errors and how to fix it. I tried several of the recommended fixes, but still could not get any of them to work to allow me to install Vue CLI.

So my solution was to go the node_modules folder, and selected “Get Info”, then under “Sharing & Permissions” and changed “everyone” to “Read & Write”. Even though I am the only user and admin on this computer, global NPM modules would not install into that folder until I added that special permission.

I seems to be working now.


#13

This worked for me as well. Also, select the Action cog-wheel and select “Apply to enclosed items” - this will give all subfolders the same access.


#14

Thank you for sharing this! I had to change permissions to Everyone - Read / Write for

  • /usr/local/lib/node_modules

  • /usr/local/bin

  1. Open Finder.
  2. Press Command +Shift+G. A dialog box opens.
  3. Enter the path

#15

The same issue occurred for me when running:

npm install -g @vue/cli

After much research and experimentation the only thing that worked instead was:

npm install -g @vue/cli@latest


#17

when try i see
The operation can’t be completed because you don’t have the necessary permission.