react-native link does not find project.pbxproj file - javascript

I have a react-native project where I changed my project name in package.json due to eslint warnings. Now when I try to run react-native link to link any library, I'm getting the following error:
Scanning folders for symlinks in /Users/my-username/projects/myproject-folder/node_modules (20ms)
rnpm-install info Linking assets to ios project
rnpm-install ERR! Something went wrong while linking. Error: ENOENT: no such file or directory, open '/Users/my-user-name/projects/myproject-folder/ios/my-old-app-name.xcodeproj/project.pbxproj'
So it doesn't find the file project.pbxproj, as it is looking at it from the wrong folder.
What I have tried so far with failed outcomes:
react-native upgrade
react-native-rename
Deleted node_modules and run npm install again
Renamed app name to correct in index.ios.js for AppRegistry.registerComponent
Where does react-native link look for the file project.pbxproj? If I find that location, I could rewrite it to the new correct one. I have no xcode, and currently only android version. I (still) have the separate index files for both versions, even I heard that after some react-native upgrade they should have been merged...

Was able to solve this by deleting the other project folders in the ios -folder. Apparently react-native just loops through every project there it finds, and picks the first one.

I stumbled this problem just today. Here are the steps I made to make it work again
Delete the ios folder
react-native eject // this will re generate the ios folder
react-native-link
I also did gradle clean before the earlier steps but I think its unnecessary.

Related

Unable To Run Android React-Native App Due to CMake Path Versions

I am trying to run my react-native application but whenver i do it crashes and gives me this error:
Could not determine the dependencies of task ':react-native-reanimated:generateJsonModelDebug'.
> CMake '3.18.1' was not found in PATH or by cmake.dir property.
CMake '3.22.4' found in PATH did not match requested version '3.18.1'.
I don't understand what this means, i believe it has something to do with the react-native-reanimated package. this package has many issues and i do not know how to resolve them.
Any help?
It means you have to update the cmake version and export to your path directory.
Open Android Studio
Access SDK MANAGER
Access tools and found CMake
Click Show Package details
Then install the version 3.18.1

React native project stucks on :unimodules-react-native-adapter:generateExpoModulesPackageList

It is an expo-eject project and the commands I have used after cloning the project are:
Yarn,
Yarn start,
Yarn android,
And it does not show any error but gets stuck on a same point everytime when I try to run the project.
The project runs fine on the laptops of other teammates, but I am facing this issue.
Here are the versions of the installed tools:
Nodejs 14.17.6,
Expo 4.11.0,
React-native-cli 2.0.1,
I am adding an image that shows where the project gets blocked.
This is the issue in running project.
Had the same issue, and tried #usama-alaf reply, which consisted of:
Installing the right SDK for the Android device
Linking the SDK path under project/android/local.properties
But none of the above worked for me. Digging a little deeper, I found this Github issue from Willem Horsten, where the developer states that there was a yarn.lock file on one of his Hard Drives. I'm actually running my development environment on a secondary HD, and I also had a lock file in the root of the drive, but after deleting it, nothing changed.
Here's what actually worked for me. I was running Node v12, and trying to build the project, and trying to check whether the Node version was the culprit, I did this:
Deleted my node_modules, yarn.lock, and all other lock files I could find (for some reason there was also a package-lock.json file on the project)
Since I'm using NVM, I switched to Node v15.14.0 (the latest I have installed).
Installed the dependencies again with yarn install
Ran yarn android, and the build worked this time.

Could not list contents of 'third-party/glog-0.3.4/test-driver'. Couldn't follow symbolic link

I have a project build on react-native version 0.55.4. It was woking fine on old system. I have to change system due to some reasons. I setup on new system, I am able to run project using react-native run-android but when building a signed APK using ./gradlew assembleRelease I am receiving following error.
Task :app:processReleaseGoogleServices
Parsing json file:
<Project-Directory>/android/app/google-services.json
FAILURE: Build failed with an exception.
What went wrong:
Could not list contents of
'<Project-Directory>/node_modules/react-native/scripts/third-party/glog-0.3.4/test-driver'. Couldn't follow symbolic link.
I know this issue is already on stack overflow Invalid symlink in node_modules error when trying to deploy to simulator (RN 0.45). I have tried it. I have also tried following github question.
https://github.com/facebook/react-native/issues/11212
https://github.com/facebook/react-native/issues/14417
https://github.com/facebook/react-native/issues/14548
https://github.com/facebook/react-native/issues/14464
I have also tried following things.
Deleting node modules and reinstalling them
Deleting .bin folder in node modules
Deleting react-native/third_party folder in node modules.
Copying node modules from older system.
Copying third-party and glog-0.3.4 from older system.
Deleting test-driver file inside third-party folder.
Unlinking test-driver file inside third-party folder.
Installing automake-1.16 and creating a new alias of test-driver file inside third-party folder.
My java version is 1.8.0_201. My android studio version is 3.3.2. Projects react native version is 0.55.4. My mac os version is 10.14.4. My x code version is 10.2.
Please help.
Thanks in advance.
Unlinking as below and restart with the cache cleaned
In project folder:
unlink ./node_modules/react-native/scripts/third-party/glog-0.3.4/test-driver
and then stop js server and run:
npm start -- --reset-cache
It should work

What to do when "requirejs is not defined" error thrown?

I had cloned a project from GitHub but when I had run it on my device it had thrown some error.
the project link is
https://github.com/mram98/quizwebapp.git
Please help me on what to do.
I had included the error screen shoot in the main directory of the repository.
The project is using bower. Once you have downloaded the project go to the project root and run bower install to install the dependencies
requiredjs is part of NodeJs
make sure you have configer Nodejs on your server
here this is might help RequireJS paths not work

How do I install Meteor Atmosphere packages locally so I can make modifications to it?

I am trying to get up and running with Meteor and seeing what it can offer, while I like it overall, it seems it's a very very rigid system.
I set up a small testing setup using Velocity, it opens a small overlay window on the side which has a class of "velocityOverlay". The overlay is really small and makes error stack traces wrap. All I wanted to do was to edit the css of the "velocityOverlay" and increase the width.
I somehow (after wasting time) managed to find that Meteor is actually putting all the packages in my user directory by default, once I found that, I found the needed css file...
velocity_html-reporter/.0.5.1.aykpxq++os+web.browser+web.cordova/web.browser/packages/velocity_html-reporter/lib/client-report.less.css
And I did a small edit to the width, next thing you know the meteor app crashes when trying to launch using the "meteor" command throwing a "Error: couldn't read entire resource" error. I can't even edit the bootstrap.css file I installed using "ian_bootstrap-3".
Further more, I can't find any way to install packages locally just for my particular project, what if I wanted to modify a package only for my particular project? this is very easy to do in vanilla Node.js, you simply don't use the "-g" when using "npm install".
To add to that, within my project root, there is another ".meteor/local/build/web.browser" folder with most of the global package files replicated again. When does Meteor use which? This is very confusing.
You can run a package locally very easily.
Download it from Github (for example) and put it in the packages/ directory of your application like this /packages/package_name.
Then add it to your application with the same meteor add package_name command as usual.
Meteor will automatically look in the local folder before anywhere else and compile the package with the rest of your code.
This allows you to do any modification you want on the package and test it locally before publishing it to the registry.
Also, folders located in .meteor/local/* are used for building purpose only and are generated automatically by Meteor. So it is not the best place to edit the files!
This worked for me https://atmospherejs.com/i/publishing. mrt link-package didn't work for me, might just be outdated code.
Steps:
Download (or clone) package from GitHub to local dir
Stop meteor if running
2.1. Make sure you have a packages folder: mkdir packages
Locally link your package:
3.1 If you have mrt installed: Run mrt link-package /path/to/package in a project dir
3.2 If you don't have mrt: ln -s /path/to/package packages/package
Then run meteor add developer:package-name, do not forget to change package name
Run meteor in a project dir
From now any changes in developer:package-name package folder will cause rebuilding of project app
Download the package and place it in new package directory in your project root.
open the package.js inside the downloaded package and remove the author's name in the property "name:"
e.g: - name:'dburles:google-maps' to name:'google-maps'
then run
meteor add google-maps

Categories