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.).
Related
I am trying to develop a react native application on MacOS, but I have been running into issues with installing watchman onto the machine. I have been running the command brew install watchman and whenever I enter the command watchman version the output displays version: 0.0.0. However, directly after running the first installation command over again, I see Warning: watchman 2022.06.06.00 is already installed and up-to-date which is really confusing me.
I have tried various different troubleshooting techniques such as uninstalling and reinstalling watchman, instead of using brew I attempted using sudo port install watchman with MacPorts, removing the .watchmanconfig file and re-creating it, and lastly restarting my device, but none of these solutions have seemed to work for me.
Whenever, I open my react native project and run the command npm start, this is the output that I see,
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.
...
watchmanResponse: {
error: 'std::__1::system_error: open: /Users/USER/Desktop/ReactNativeApp: Operation not permitted',
version: '0.0.0'
}
This error message ends the npm start and because of this, I am unable to run npm run ios and continue with the development of the application. If anyone happens to know of any fixes or has experienced this before I would appreciate it if you share how I can resolve it. Thank you.
We can resolved this when we put our project outside from those folder Desktop,Download and Document
then run
npm start
It will be work
thanks
I ran into this strange error today: Unable to resolve module `#expo/vector-icons/FontAwesome` from `node_modules/react-native-elements/src/checkbox/CheckBoxIcon.js`: #expo/vector-icons/FontAwesome could not be found within the project.
This project does not use expo, it was built using vanilla React Native CLI. I checked the CheckBoxIcon.js file in node_modules and I don't see any references to #expo.
Not sure if it matters but I was working on ane xpo project prior to this but it shouldn't be affecting this separate project I'm working on, will it?
I'm not sure how to fix this, I have tried clearing watchman watches, deleting node_modules and reset metro's cache.
npm start --reset-cache did not work but npm start -- --reset-cache fixed my issue.
Has anyone made eslint work with create-react-native-app in vscode on Windows 10? It is so unstable it's making my skin itch!
Latest npm doesn't work with create-react-native-app so I installed yarn. Now I can create an app. But I have to do this with cmd prompt outside of vscode otherwise I get no QR code to launch app on my phone.
I tried to install eslint locally with yarn, and use airbnb linting rules - this fails - if I install it with npm it works and I can initialise it with airbnb rules. Yay! I now have linting in my project.....but wait! Now I cannot start my project anymore because:
react-native-scripts start
'react-native-scripts' is not recognized as an internal or external command,
operable program or batch file.
This is killing me!! It's taken about 8 hours of $%^#ing around and I haven't even got to try any react native coding yet! Is it supposed to be this insane just to set up the environment?!!?
Anyone have any suggestions? I googled and looked at github issues but I see no solutions for this.
Thanks in advance!
Version 1.5.2 of create-react-app has options for using npm instead of Yarn as well as using a specific npm version. Use create-react-app -h to view help.
Have you also tried adding the following to your VS Code settings when using Yarn?
"eslint.packageManager": "yarn"
I'm just starting out with react native. Everything was going ok but now when I run 'react-native run-ios' the packager is looking for js files in
<project-root>/node_modules/react-native/packager
instead of
<project-root>
If I run 'node node_modules/react-native/local-cli/cli.js start'
it looks for files in the correct location.
This is happening in my existing project and if I create a new project using react native init. It started after I installed a new npm module. I've since reverted the change, re-installed modules, cleared the tmpdir cache, rebooted computer etc. Can I explicitly configure the packager entry point?
Any help greatly appreciated
C
This is a known issue with RN 0.45, I have also encountered this problem today after upgrading from 0.42.
https://github.com/facebook/react-native/issues/14246
The temporary solution until RN is fixed (next release?) is to run:
npm start -- -reset-cache
You can also try:
npm run start -- --root <mydir>
This will cause the packager to look in the correct location.
Until this is corrected it's a pain, as it means we have to invoke the reset every time the packager is started either from XCode or react-native run-ios.
The next release is later this month: https://github.com/facebook/react-native/releases/tag/v0.46.0-rc.0
Update
This has now been fixed in release 0.45.1
What worked for me was reverting to 0.43.1 (a version that I have other apps working with): delete node_modules, change package.json under dependencies to "react-native": "0.43.1", and npm install. Verify your version with react-native --version, and run again.
ERROR EPERM: operation not permitted, lstat '...\.idea\workspace.xml___jb_old___'
{"errno":-4048,"code":"EPERM","syscall":"lstat","path":"...\.idea\\workspace.xml___jb_old___"}
Error: EPERM: operation not permitted, lstat 'app\.idea\workspace.xml___jb_old___'
at Error (native)
After that I should again do:
npm start
How to resolve this quite annoying problem?
Thanks
Solution:
How to fix the file permissions, after loading end
react-native start
First, Go to android folder
cd android
Now clean the project...
gradlew clean //for Mac users, change gradlew to ./gradlew
Now run the build process again in the root folder
cd ..
react-native run-android
I think it's the problem of 'save write', I am using Webstorm, uncheck "File->Settings->System Settings->sychronization->use safe write" to see if it helps you.
Basically it looks like windows bug on react packager. When you disable Hot Reloading, it should be stopped. If not, can you try "npm cache clean" before run "react-native run-android", please? Also you can try to run on administrator. If these are not working, maybe it's about Antivirus app.
Also can you add ".idea" folder to your github ignore file to try? And are you trying to run it from Webstorm (or any eclipse-based platform) directly or terminal?
Closing SourceTree did the trick for me. Once I pushed my changes to the repository also crashed server (I suppose GitKraken has the same effect).
The best temporary fix I found for this was that when you do react-native run-android, look out for the React Package Manager and as soon as it opens, close it and wait until the progress of react-native run-android says BUILD SUCCEEDED and then open another cmd in the same Directory of your react-native project and do npm start. If the server crashes again or you get any error, you can just do npm start again and continue your work.
One of the cause can be if any of npm server(cmd terminal window) whether it is your project's sever or other project then close it and now you will not get this error
I am currently experimenting with expo and I am finding this behaviour whenever I try to edit files.
The mentioned solution by #user6795391 worked for me however at some point the setting in Webstorm changed to Back up files before saving
https://www.jetbrains.com/help/webstorm/system-settings.html
Obviously please consider the implications of disabling this!
use
$ react-native start
І hope it works