Macbook React Native install

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! Please try running this command again as root/Administrator.

npm ERR! A complete log of this run can be found in: npm ERR!

When I try to start. npm install - g react-native-cli. I am taking this error. What can I do?

- - Source


answered 1 year ago wuno #1

This is simply a permission problem. Basically NPM is trying to write to a directory that is owned by root. There are a few ways to get around this.

  1. You can use the recommended solution from the docs here. Basically it suggest you use a package manager. For example Home Brew is a great one if you are using OSX.

  2. You can install the packages using sudo. This could cause you other problems though and a lot of people freak out about this. In other words,

    sudo npm install - g react-native-cli

  3. You could update the permissions on this folder allowing you to install things to it. This would mean that your user has the right to write to /usr/local/lib/. Type this command into the terminal,

    sudo chown -R $USER /usr/local

Sometimes depending on your system different steps need to be taken. This is actually a very common problem and typically happens to us when we update our systems OS. If this is the first time you have seen this chances are you will see it again. So try and look around and read about the problem. You will notice a lot of the times the solution is to use something like homebrew to install things. Sometimes homebrew can have a permission problem when a new OS comes out. These solutions are always some combination of chown or chmod to give a user's account write access to a specific directory.

For more information on HomeBrew please see this link.

answered 9 mon ago Uray Febri #2

i have same issue with this but i just typing npm install -g install-react-native-app then i put sudo in the front so seem like this sudo npm install -g install-react-native-app and the file is work.

comments powered by Disqus