React-native: Getting issue when i was give this npm install -g react-native-cli

Created on 6 Jun 2018  路  12Comments  路  Source: facebook/react-native

Apples-MacBook-Pro:~ Mac$ npm install -g react-native-cli
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!     /Users/Mac/.npm/_logs/2018-06-06T09_15_48_372Z-debug.log
Apples-MacBook-Pro:~ Mac$ 

Ran Commands Locked

Most helpful comment

try with sudo :
sudo npm install -g react-native-cli

it is installed globally and therefore require permissions

All 12 comments

try with sudo :
sudo npm install -g react-native-cli

it is installed globally and therefore require permissions

OKay thanks for your Response


It looks like your issue may be incomplete. Are all the fields required by the Issue Template filled out?

If you believe your issue contains all the relevant information, let us know in order to have a maintainer remove the No Template label.

sudo will solve this, but you should not be using that. This means node was installed in the wrong way. You should try to uninstall node and install it via homebrew. Allowing node sudo access with third party packages is just stupid.

If you are still encountering the issue described here, please open a new issue and make sure to fill out the Issue Template when doing so.

sudo helped me.

sudo npm install -g react-native-cli

This helped me as well, I used sudo in the command line and was able to install react-native-cli successfully.

sudo will solve this, but you should not be using that. This means node was installed in the wrong way. You should try to uninstall node and install it via homebrew. Allowing node sudo access with third party packages is just stupid.

Why is it stupid?

I have give npm the sudo priority but it still isn't get the priorty:

(base) mrfive@mrfive-lenovo:/opt/node-v9.11.1-linux-x64/lib/node_modules/swagger-editor$ sudo npm uninstall -g swagger-editor
npm WARN deprecated [email protected]: WARNING: This project has been renamed to js-file-download. Use js-file-download instead.
npm WARN deprecated [email protected]: core-js@<2.6.5 is no longer maintained. Please, upgrade to core-js@3 or at least to actual version of core-js@2.
npm WARN checkPermissions Missing write access to /opt/node-v9.11.1-linux-x64/lib/node_modules/swagger-editor/node_modules/async
npm WARN checkPermissions Missing write access to /opt/node-v9.11.1-linux-x64/lib/node_modules/swagger-editor/node_modules/asynckit
npm WARN checkPermissions Missing write access to /opt/node-v9.11.1-linux-x64/lib/node_modules/swagger-editor/node_modules/[email protected]@chalk/node_modules/has-ansi
npm WARN checkPermissions Missing write access to /opt/node-v9.11.1-linux-x64/lib/node_modules/swagger-editor/node_modules/cookiejar
npm WARN checkPermissions Missing write access to /opt/node-v9.11.1-linux-x64/lib/node_modules/swagger-editor/node_modules/deep-extend
npm WARN checkPermissions Missing write access to /opt/node-v9.11.1-linux-x64/lib/node_modules/swagger-editor/node_modules/esprima
npm WARN checkPermissions Missing write access to /opt/node-v9.11.1-linux-x64/lib/node_modules/swagger-editor/node_modules/form-data/node_modules/asynckit
npm WARN checkPermissions Missing write access to /opt/node-v9.11.1-linux-x64/lib/node_modules/swagger-editor/node_modules/has-ansi
npm WARN checkPermissions Missing write access to /opt/node-v9.11.1-linux-x64/lib/node_modules/swagger-editor/node_modules/[email protected]@js-yaml/node_modules/esprima
npm WARN checkPermissions Missing write access to /opt/node-v9.11.1-linux-x64/lib/node_modules/swagger-editor/node_modules/json-refs/node_modules/slash
npm WARN checkPermissions Missing write access to /opt/node-v9.11.1-linux-x64/lib/node_modules/swagger-editor/node_modules/process-nextick-args
npm WARN checkPermissions Missing write access to /opt/node-v9.11.1-linux-x64/lib/node_modules/swagger-editor/node_modules/react-lifecycles-compat
npm WARN checkPermissions Missing write access to /opt/node-v9.11.1-linux-x64/lib/node_modules/swagger-editor/node_modules/[email protected]@react-split-pane/node_modules/react-lifecycles-compat
npm WARN checkPermissions Missing write access to /opt/node-v9.11.1-linux-x64/lib/node_modules/swagger-editor/node_modules/[email protected]@react-split-pane/node_modules/react-style-proptype
npm WARN checkPermissions Missing write access to /opt/node-v9.11.1-linux-x64/lib/node_modules/swagger-editor/node_modules/react-style-proptype
npm WARN checkPermissions Missing write access to /opt/node-v9.11.1-linux-x64/lib/node_modules/swagger-editor/node_modules/readable-stream/node_modules/process-nextick-args
npm WARN checkPermissions Missing write access to /opt/node-v9.11.1-linux-x64/lib/node_modules/swagger-editor/node_modules/slash
npm WARN checkPermissions Missing write access to /opt/node-v9.11.1-linux-x64/lib/node_modules/swagger-editor/node_modules/superagent
npm WARN checkPermissions Missing write access to /opt/node-v9.11.1-linux-x64/lib/node_modules/swagger-editor/node_modules/underscore
npm ERR! path /opt/node-v9.11.1-linux-x64/lib/node_modules/swagger-editor/node_modules/async
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall access
npm ERR! enoent ENOENT: no such file or directory, access '/opt/node-v9.11.1-linux-x64/lib/node_modules/swagger-editor/node_modules/async'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/mrfive/.npm/_logs/2019-04-17T16_31_40_722Z-debug.log

@MrFive5555 i had face the same problem. if you solved ,please mention

There are certain actions which are not advised to be done with the permission "root"; which means this issue might be encountered even when using sudo before npm

in this case try using something like:
npm install --unsafe-perm=true --allow-root -g react-native-cli

Note: This issue might still come up when installing certain npm packages during your development

add: --unsafe-perm=true --allow-root after npm install or npm -i

most complicated way to solve this problem (seems to by correct))))
https://youtu.be/bxvybxYFq2o

Was this page helpful?
0 / 5 - 0 ratings