Error for no installation of react-native - react-native

Peace be upon you!
I tried to run my react-native project which previously did work correctly. However, after sometime I came back and tried, as a result, I got this error which tells me that ""react-native-web" is added as a dependency in your project's package.json but it doesn't seem to be installed. Please run "yarn" or "npm install" to fix this issue."
Any solutions for this?

ERROR:
"react-native" is added as a dependency in your project's package.json but it doesn't seem to be installed. Please run "yarn" or "npm install" to fix this issue.
React-native Expo package.json error
SOLUTION:
READ MORE: https://docs.expo.io/
Unable to start the project.
Follow these steps to solve the problem and start the project:
Delete the node_modules folder.
Run "yarn install" or "npm install".
Run "expo start" or "npm start".
React-native Expo package.json error solution
I hope this should solve your problem!

Related

I'm getting an Expo Devtools Error when I start Metro after updating Expo

I have just updated Expo to version 5.3.0, and now I am getting this error:
"Error loading DevTools, No scheme specified for development client"
The error appears on a black screen in the browser instead of the expected devtools. The same thing happens when I run either "yarn start" or "npm start".
I have tried reinstalling Expo again, and reinitiating my project again.
So what is the scheme? And how do I include it in my project?
I noticed that in the command line I was also getting this error: "Linking is disabled because the client scheme cannot be resolved". I did a search and found a solution on GitHub: https://github.com/expo/expo-cli/issues/4140.
Solution:
npx uri-scheme
And then
npx uri-scheme add project-name
Try running "expo start" instead.
yarn start or npm start maybe running expo start --dev-client
change it to expo start in
package.json

eject command not found in create-react-app -- how to add to package.json?

I get this error after installing create-react-app, and trying to run "npm run eject"
eject: command not found.
How do I edit package.json to run the command I found in the documentation?
I found a work-around: run the script, manually, found in node_modules/react-scripts/scripts/eject.js.
node ./node_modules/react-scripts/scripts/eject.js
facebook's github indicates that the global install of create-react-app would interfere with CRA installation; and so I ran:
npm rm -g create-react-app
as suggested on facebook's github here:
https://github.com/facebook/create-react-app/issues/8088#issuecomment-562189517
(and then reinstall CRA)
You have to install
https://github.com/ramyareye/react-native-eject
yarn add react-native-eject
yarn react-native eject
Instead of npm try with npx
npx react-scripts eject
Above command worked for me.

React Native: error: bundling failed: index.js: "" is not a valid identifer name

I have a React Native app which was running perfectly earlier this morning. I've deleted package-lock.json after mistakenly doing an npm install instead of a yarn install. Then I've ran yarn install and now when I try to run my app I get this error at the packager:
error: bundling failed: index.js: "" is not a valid identifer name
BUNDLE [ios, dev] ./index.js ░░░░░░░░░░░░░░░░ 0.0% (0/1), failed.
I've also closed packager and Vscode, removed node_modules and tried running yarn install again but I get the same error. I haven't changed a single line in my code and it was working before that.
What is going on?
It is already opened as an issue.
https://github.com/facebook/react-native/issues/27118
https://github.com/facebook/react-native/issues/27120#issuecomment-549832676
Simply you need to delete "node_modules" and again run the command:
npm i or yarn
Also, you can simply re-create the scratch project with
react-native init example
It will work as expected. They reverted the changes on #babel/run-time at 7.7.1 version.
Have fun 🎊🎉
Delete node_modules and packages-lock.json, erase trash, close Metro Bundle, delete the app from emulator/simulator and run npm install, this way worked for me.
I had the same issue and none of the solutions mentioned here or in the links worked for me. The issue was the react-native local and global versions were different.
node node_modules/react-native/local-cli/cli.js run-ios worked for me.
and while bundling, node node_modules/react-native/local-cli/cli.js bundle --entry-file...
In short replace react-native with node node_modules/react-native/local-cli/cli.js when trying to run or bundle

Errors when trying to run react-native on ios

so I developed an app in react-native, already runs and tested on Android, but now its the ios part.
I'm working with react native version 0.60.3, on MacOS, using yarn as package manager.
I'm running "react-native start --reset cache".
then running "react-native run-ios:" on a separate console,
and getting this error:
"
error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening app.xcworkspace.
....
error: Unable to resolve build file: XCBCore.BuildFile (missingTargetProductReference(...))
"
so then im trying to run with Xcode and i get this error on the "react-native start --reset-cache" console:
"
Error: Unable to resolve module ./index from /Users/nono/work/myapp/.: The module ./index could not be found from /Users/nono/work/myapp/.. Indeed, none of these files exist:
* /Users/nono/work/app/index(.native||.ios.js|.native.js|.js|.ios.json|.native.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx)
"
and this error on the iphone simulator :
I'm desperate ... please help!
UPDATE:
now the first error doesn’t occur.
I only get the "Unable to resolve './index' ... "
error
Try to run the following commands on terminal:
npm install
cd ios; pod install; cd../
react-native link
try this:
Stop the MetroBundler/launchPackager
Delete node_modules
rm -rf node_modules
Change the version on your package.json
from
"react-native": "0.59.1",
to
"react-native": "0.58.6",
Then clean the watchman
watchman watch-del-all
Run npm install again:
npm install
And try to run your project, in my case:
react-native run-ios
My bad. I accidentally deleted the index.js ..

React Native Init Hanging

I am unable to create a new React Native project via react-native init <ProjectName>.
This is the first time I've tried since upgrading to macOS Sierra, but I don't know if that's related.
If I run the command with the --verbose flag, it runs through all the npm packages, but then eventually outputs the following:
├── UNMET PEER DEPENDENCY react#~15.3.1
<List of other packages including react-native 0.34.1>
npm WARN react-native#0.34.1 requires a peer of react#~15.3.1 but none was installed.
npm verb
npm verb If you need help, you may report this error at:
npm verb <https://github.com/npm/npm/issues>
npm verb exit [ 0, true ]
npm info ok
It then just sits there indefinitely. Last time I created a react native project it would take maybe 20-30 seconds max, but now it never completes (after say 10-15 minutes).
If I kill the process, all I have is a package.json with just the following in:
{
"name": "TestApp",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start"
},
"dependencies": {
"react-native": "0.34.1"
}
}
...and the node_modules folder containig react-native and its dependencies. None of the required XCode/Android folders are there, or the index entry points, configs etc.
I have tried reinstalling all the required dependencies (node, homebrew) and I have also reinstalled git via homebrew.
I've seen other threads that suggest manually installing React, but I don't buy it. This used to work and React used to get installed as part of the process, but now I get this warning and it's game over.
Anyone else seen this issue?
EDIT
I just tried this on my other Mac, also running macOS Sierra and it worked fine. I followed the same steps on that to ensure all my dependencies were up to date first. I did a verbose init and still got the warning about React 15.3.1 being missing, but it then carried on and install Reacrt 15.3.2 and then set up all the XCode/Android project files.
Very odd/annoying as I really need to start putting something together on this Mac.
SECOND EDIT
If I create a new user account on my Mac and log in as that, I can create a project, so it seems to be user-specific. Although annoying, I don't mind setting a new account up, but before I do would like to see if anyone can offer any suggestions. Thanks.
So the issue turned about to be watchman, as outlined here: https://github.com/facebook/react-native/issues/9943
If I ran watchman version the terminal hung, so as per the instructions I did:
rm -rf /usr/local/var/run/watchman/ && brew uninstall watchman && brew install watchman
...and it worked a treat!