Today i decided to start react native cli project. Everything works great since i want to add new lib of course using npm . So i ran npm install ... . And this command always stuck on
Image
idealTree: timing idealTree Completed in 3440ms
And nothing happened. So i tried to ran
npm install --verbose
And again stuck on the same place. Also clear cache npm cache clear --force and nothing happened again. I don'n know how to fix this
I have had npm install freeze on me numerous times, lately. I'm not sure of the cause. When that happens I follow these steps:
Kill the npm install process with ctrl+c.
Delete node_modules. If there are files that you cannot delete because they are currently in use, that may mean that the npm install process was not successfully stopped. Try opening Task Manager and ending all nodejs and terminal processes. If this fails, restart your pc and then delete node_modules
Clean cache and reinstall node_modules with npm cache clean --force && npm i
This has happened to me a few times before and all I had to do was kill my dev server before running npm install.
Hope that helps as well!
I had the same issue on node latest version v18.8.0 and npm v8.18.0, I just downgraded to node 16.6 using nvm and it worked fine.
For me, the issue was that I had node running for a separate project. Terminating the other node process fixed the issue.
When i opened my package.json i saw '~2.2.1' in front of react-native-gesture-handler which probably means that it was notinstalled properly
Just close all terminals and then open task manager and kill all the processes corresponding to NodeJS. Then install it again.
Hopefully it will resolve.
I also faced this problem and the solution was simple by stopping all the "nodejs terminals" that are working outside.
When you stop nodeJS Terminals running in the background, it will complete the current installation process.
enter image description here
When you want to add package on your project it is better to stop server before adding new package.
I had same problem but after doing this it is solved.
Some context: I've recently been trying to update a react native project that uses expo, since I have not worked on the project for about four months. I believe I finally was able to successfully upgrade the project as expo is starting. The issue is that I am now having some trouble with some of the newer modules I just installed with npm. This error seems to be coming from me not knowing how to use the commander module. Additionally, I do not believe that I have a thorough understanding of modulues in react native/expo. I am using ubuntu 20.04 via windows terminal.
Error:
I did go to the website mentioned in the error. I believe that this link - https://github.com/tj/commander.js#avoiding-option-name-clashes - is what will solve my problem. However, I am confused as to where I should put the example file and how to use it.
I am not very well versed in modules for react native/expo and it is quite possible that I do not need to use this module (I thought that installing it would make my react native program run, but that does not seem to be the case).
Thus, I am looking for advice on either how to use this module, or on whether or not I should be using these modules (after updating node and then expo, the following modules could not be found every time I ran npm start, so I decided to install them using sudo npm install module_name -g since some other stackoverflow/github pages recommended that):
fs-extra
terminal-link
chalk
getenv
commander
#expo/xdl
Any help would be appreciated, and I would be happy to provide any more information that would be relevant.
I was not able to figure out a way to make the project work with the above modules. So, I followed the advice of a post I made on the expo forums (I posted similar context there and also the answer that I wrote below).
If you do not want to click the link, here are the steps below:
Basically, I uninstalled expo using the following command: npm -g uninstall expo-cli --save && yarn global remove expo-cli. Then I proceeded to remove the .expo folder from my home directory. More details on these two steps can be found here.
After that, I reinstalled expo using npm install --global expo-cli, from the expo documentation, in the install section.
Then I closed my terminal, reopened it, and ran expo whoami. The command returned recommending an update, so I followed the provided update command (which I believe was just npm install --global expo-cli again).
I closed the terminal, reopened it, and ran expo whoami again. This time I was just met with "you are not logged into expo" (or something along those lines). So, everything seemed up to date.
I then went to project and ran npm start and it worked fine.
Note: You may need to use sudo for any uninstall and install commands above (your terminal will likely tell you if you do).
Note Clearing cache for npm and yarn may take some time. Additionally, the first time you run npm start may also take some time. I'd say all in all this took about two to three hours, but my computer is also not the best.
I have used create-react-native-app and expo to build an application on a vagrant ubuntu and run it using yarn start.
When i make changes to my file on my host machine, the changes are not
reflected.
With create-react-app, CHOKIDAR_USEPOLLING=true worked and all my
changes were reflected instantly but this is not the case for native.
Does anyone know how to get this to work?
Please try using yarn start instead of npm start since your current of npm (5) has issues with create-react-native-app as of today.
I just upgraded react-native version to 0.48.1 from 0.30 and I am facing a weird issue.
I fixed all the peer-dependencies for the libraries that I am using. then ran command,
react-native start
running above command starts packager. Now when I hit below url to generate jsbundle,
http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false
I am getting below error,
"message":"Ambiguous resolution: module '$PROJ_ROOT_DIR/index.android.js' tries to require 'react-native', but there are several files providing this module. You can delete or fix them:
$PROJ_ROOT_DIR/node_modules/jest-react-native/node_modules/react-native/package.json
$PROJ_ROOT_DIR/node_modules/react-native/package.json"
$PROJ_ROOT_DIR is my project directory path.
I don't have any '$PROJ_ROOT_DIR/node_modules/jest-react-native/node_modules/' directory in my setup.
I tried deleting node_modules directory then running npm install. but nothing changed.
I have also tried, clearing packager cache by running command,
ls -l $TMPDIR/react-*
but nothing happened.
Has anyone faced similar issue? any suggestions?
Thanks in advance!
In case anyone else facing same issue of similar issues, Clearing cache using below command worked for me.
npm start -- --reset-cache
I was trying react-native start -- --reset-cache command which does nothing(my bad.).
Just installed react native and trying to get Hello World up and running. Been receiving this error for the last few hours:
"No bundle URL present.Make sure you're running a packager server
or have included a .jsbundle file in your application bundle."
I've referred to this: What means of no bundle URL present in react-native? and other similar questions, and tried everything: using my ip addresse, different combos of react-native run-iso and npm install while running and not running, tried deleting builds, cleaning project, restarting Xcode, simulator multiple times, tried react-native-upgrade, edited into.plist to allow arbitrary loads, manually setting the path to my index.ios.js, everything, and nothing works.
I noticed many ran into this issue when trying to build on their device. i'm not trying to do anything fancy, just get 'hello world' up and running.
Any other solutions I am not aware of?
cd into YOUR_PROJECT/ios and rm -r build, then run again react-native run-ios
I have the same issue, my problem was with info.plist I just
config it as the following:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSAllowsArbitraryLoadsInWebContent</key>
<true/>
<key>NSAllowsLocalNetworking</key>
<true/>
</dict>
from this solution https://stackoverflow.com/a/48471978/1627358
And then add Bash config file .bashrc with this command:
echo "alias rni=\"kill \$(lsof -t -i:8081); rm -rf ios/build/; react-native run-ios\"" >> ~/.bashrc; source ~/.bashrc
Then run rni
from this solution https://stackoverflow.com/a/44080527/1627358
And it works fine with me.
run the following code:
killall -9 node
rm -rf ios/build
react-native run-ios
it will open launchpackager.command and the application will install on the ios simulator
The solution that worked for me.
You need to run:
yarn start
And at the same time (in a different terminal window):
yarn run:ios
Assuming that you are using nvm and multiple versions of node installed, here is the solution:
Say that you run npm install -g react-native-cli in node v6.9.5.
Now make node v6.9.5 as default by running nvm alias default 6.9.5
Now run react-native run-ios
The problem is, you have multiple versions of node installed via nvm and to install react-native-cli you have switched or installed latest version of node, which is not marked as default node to point in nvm yet. When you run react-native run-ios this opens up another new terminal window in which default nvm is not pointed to the node version where you have installed react-native-cli. Just follow the above setup, I hope that should help.
Answered the same here: https://stackoverflow.com/a/45267703/1292050
I had this issue after I run the following commands to clean the project to see the changes which were invisible because of the cache and so on:
watchman watch-del-all
rm -rf node_modules && npm install
rm -rf /tmp/metro-bundler-cache-* or npm start -- -- reset-cache
rm -rf /tmp/haste-map-react-native-packager-*
The reason for the issue was in the comment in dom-structure which didn't let the application run on the device. So, check the comments too ;)
faced similar issue while running in real device app was getting crash after uploading to testflight upload and install folks this issue is killer
saved by this link
https://onexlab-io.medium.com/no-bundle-url-present-fixed-ca2688a80f66
The solution that worked for me.
> sudo vim /etc/hosts
add
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
then
> sudo killall -HUP mDNSResponder
the reason is I change hosts
I had the same issue happen to me not too long ago. It appears that if you renamed the project to something else and the project folder itself was renamed, you need to make sure you replace all instances of the old name with the new name and do not forget to change file names of your .xcscheme in ProjectName > ios > ProjectName.xcodeproj > xcshareddata > xcschemes. I also had to remove the build directory. Hope this works for you as well!
I've run into this issue when I tried to sync my files to iCloud Drive. I have no idea what causes this, but as soon as I turn off my iCloud Drive and reinstall brew and Node, it started to work again. I can only think that when I turned on iCloud Drive, I might have ended up having two different Node versions or any other dependency.
To debug, your best first step is to scroll through the log text that outputs in the terminal window where you fired off "npx react-native run-ios" and search for the word like "error" or "failed". This will point you toward something more specific than the general "No bundle URL present" error.
For example, you might see something like "BUILD FAILED The following build commands failed: ProcessInfoPlistFile". In this example, I'd then know to go check on my Info.plist. You might see something different, but the debug methodology would still be the same.
If you are trying to run iOS, another idea is to build your app with Xcode itself by opening <YOUR_PROJECT_NAME>.xcworkspace with Xcode, then review its error messages.
Similarly, if you are trying to run Android, then try running with Android Studio and review its error messages.
Lots of answers are given, but one thing you should surely be taking care of while facing this issue is to
make sure that your Metro server is running.
npx react-native bundle --entry-file='index.js' --bundle-output='./ios/main.jsbundle' --dev=false --platform='ios' --assets-dest='./ios'
Try This, clear project, and run in xCode.
This relates to the answers from #Daria Kozlova and #Daniel Twork
I needed to have the server running in another tab, i.e. yarn start
But what I hadn't noticed is that the server had crashed with an error like:
jest-haste-map: Watchman crawl failed. Retrying once with node crawler.
Usually this happens when watchman isn't running. Create an empty `.watchmanconfig` file in your project's root folder or initialize a git or hg repository in your project.
Error: Watchman error: std::__1::system_error: open: /Users/anentropic/Documents/Dev/Work/myproject/mobile-app: Operation not permitted. Make sure watchman is running for this project. See https://facebook.github.io/watchman/docs/troubleshooting.
...
watchmanResponse: {
error: 'std::__1::system_error: open: /Users/anentropic/Documents/Dev/Work/myproject/mobile-app: Operation not permitted',
version: '2022.09.12.00'
}
The fix for that can be found here:
https://github.com/facebook/watchman/issues/977#issuecomment-1189903929
i.e. run:
watchman watch-del-all
watchman shutdown-server
and then yarn start again
react-native run-ios works now
just try,
npm start
npm react-native run-ios
The below solved the same problem i had
brew update
brew reinstall watchman
Edit /etc/hosts
127.0.0.1 localhost
this is work for me !!!