React Native ~ Troubleshooting ~ General - rohit120582sharma/Documentation GitHub Wiki

NPM locking error

If you encounter an error such as npm WARN locking Error: EACCES while using the React Native CLI, try running the following:

sudo chown -R $USER ~/.npm
sudo chown -R $USER /usr/local/lib/node_modules

EACCES: permission denied

Error

npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'

Solution

It is permission denied error (in iOS/Mac). Use sudo (superhero) prefix for permission.


Error code ENOTFOUND

error code ENOTFOUND
18 error errno ENOTFOUND
19 error network request to https://registry.npmjs.org/create-react-native-app failed, reason: getaddrinfo ENOTFOUND proxy.corp.globant.com proxy.corp.globant.com:3128
20 error network This is a problem related to network connectivity.
20 error network In most cases you are behind a proxy or have bad network settings.
20 error network
20 error network If you are behind a proxy, please make sure that the
20 error network 'proxy' config is set properly.  See: 'npm help config'

Solution

Do clear/comment the below code from C:Users.npmrc file

proxy=http://proxy.corp.globant.com:3128/
https-proxy=http://proxy.corp.globant.com:3128

Cannot find module 'schedule/tracking' from 'ReactNativeRenderer-dev.js'

npm i schedule@0.4.0 --save-dev

Port already in use

The React Native packager runs on port 8081. If another process is already using that port, you can either terminate that process, or change the port that the packager uses.

Terminating a process on port 8081

Run the following command to find the id for the process that is listening on port 8081:

$ sudo lsof -i :8081

Then run the following to terminate the process:

$ kill -9 <PID>

Using a port other than 8081

You can configure the packager to use a port other than 8081 by using the port parameter:

$ react-native start --port=8088

You will also need to update your applications to load the JavaScript bundle from the new port.

⚠️ **GitHub.com Fallback** ⚠️