14

I get this error when running a new react native project. There is no error with the default starter code, but if a change even a letter of the starter text, I get this error.

Failed to load bundle(http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false) with error:(/Users/Pandey/Final/App.js: ENOENT: no such file or directory, uv_cwd (null))

user10034296
  • 179
  • 1
  • 1
  • 7
  • Most of the time, you only need to restart your metro-bundler. If I start the App via XCode, the Bundler will be open in a seperated Terminal-Window (which keeps opend). Only closo this window & run your app from Xcode again. – suther Feb 06 '19 at 10:49

8 Answers8

17

I had the same issue while building a node module and trying that in the test app. I solved it by closing and restarting the metro bundler.

The other methods I tried (but did not work for me):

  1. react-native upgrade
  2. unlink and link the module
  3. uninstalling the package and reinstalling.

Hope it was helpful! Cheers!

Kowsalya
  • 1,378
  • 16
  • 25
Pukar Sharma
  • 203
  • 2
  • 5
4

I had a similar issue and solved by switching to another directory (a non-npm project) and updating my global npm from there:

sudo npm install -g npm

then I switched back to the project and re-install the dependencies with npm install.

Francesco Borzi
  • 56,083
  • 47
  • 179
  • 252
2

Seems to be an issue with the metro-bundler task. Check your terminal tabs to see if any are open from a previous project.

Metro Bundler Task in Terminal

Control + C to end it. If you know the port it was running on, you can check the port and kill the tasks from there.

ex. sudo lsof -i :8080

Find the PID and kill it with kill -9 PID_NUMBER.

Then go back to your root project directory and run npm start to start a new Metro Bundler.

Dan
  • 919
  • 1
  • 10
  • 28
2

I just encountered this. I had multiple tabs open in my terminal, including one that had cdd into a now-deleted copy of my project directory.

In other words, i'd deleted the directory in a different tab and re-cloned it from Github. The other terminal tab was stuck in a 'ghost' directory.

cd out of it and back in and you should be fine.

Jim O'Connell
  • 81
  • 2
  • 3
1

It could also be that you have renamed a folder and your shell got messed up.

Yogesh Nikam Patil
  • 1,192
  • 13
  • 18
0

If you are using capistrano and PM2 to deploy your project, this might happen due to them not being in sync. The proper thing to do in such case, would be to kill PM2 daemon, and start afresh. So, that capistrano will treat it as a new instance. This helped in my case.

0

run this command on terminal

$ killall node

and check again I hope this error will not come again

Muhammad Numan
  • 23,222
  • 6
  • 63
  • 80
0

I just change the directory and create project here its work fine

samran
  • 581
  • 6
  • 7