Got issues when installing new components to react-native project - react-native

Having issue in installing react-native-slider
I just tried this command
npm i --save react-native-slider
It shows following message.
added 1 package and removed 29 packages in 1.944s
But it removed react packages
After that i am not able to run the project.

You can do the following things
rm -rf node_modules
npm install

Related

Expo fails to build, Request failed with status code 400

I'm trying to build a project in expo react native project.
My expo version is 3.2.2, sdkVersion is 35.
When I ran in cmd (on Windows 10)
set EXPO_DEBUG=true
expo build:android -c
I got:
Request failed with status code 400
Error: Request failed with status code 400
at createError (C:\Users\Jonny\AppData\Roaming\npm\node_modules\expo-cli\node_modules\axios\lib\core\createError.js:16:15)
at settle (C:\Users\Jonny\AppData\Roaming\npm\node_modules\expo-cli\node_modules\axios\lib\core\settle.js:17:12)
at IncomingMessage.handleStreamEnd (C:\Users\Jonny\AppData\Roaming\npm\node_modules\expo-cli\node_modules\axios\lib\adapters\http.js:237:11)
at IncomingMessage.emit (events.js:203:15)
at endReadableNT (_stream_readable.js:1145:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
I'm tried to update expo version, sdkVersion, the version in react, check for internet connection.
Expo login and logout works fine. I don't have any proxy in my network.
I don't have any clues for what search or how to fix this problem.
Seems was a error in expo-cli version 3.2.2.
The update 3.2.3 fixed for me.
I have fixed the issue by using this command
Move to your root folder then type this command in your terminal
npm install -g expo-cli
I had two versions of expo-cli installed (one via yarn global install expo-cli and one as a dev dependency in project yarn add -D expo-cli). This started working for me after I removed the global expo-cli:
yarn global remove expo-cli
and used the local version in my project instead:
yarn run expo-cli start
Run those following command, then we are good to go.
$ yarn global remove expo-cli && yarn global add expo-cli
$ rm -rf node_modules/ yarn.lock && yarn install
$ yarn run start

How to fix Something went wrong installing the "sharp" module and Cannot find module '../build/Release/sharp.node' in expo

I tried to install expo after I executed the command exp start but I got:
Something went wrong installing the "sharp" module
Cannot find module '../build/Release/sharp.node'.
How can I fix this problem?
I had the same problem and this single line command did the trick.
npm rebuild --verbose sharp
Consult the installation documentation at Common problems.
Find the latest version of sharp and install it.
npm install sharp#0.28.3 --save
This worked for me.
I am not using expo but faced this issue in react native.
All I did is "deleted node_modules/sharp" folder.
run npm install.
fixed the issue.
Maybe you configured npm to ignore installation scripts. In that case delete the sharp module and run:
npm install --ignore-scripts=false
This causes after i updated, npm,angular version.
just try
npm i cordova-res
it solves above problem.
I was facing same issue in mac when I update my developer tools using xcode-select install then node project stop working on local
sudo rm -rf /usr/local/Cellar/python3.8
sudo rm -rf /usr/local/Cellar/python3.9
rm yarn.lock
rm package-lock.json
rm -rf node_modules
brew upgrade
yarn install
worked for me
If anyone has this problem and other solutions didn't solve it. Try to uninstall vips globally, it worked for me.
npm -g uninstall libvips
brew uninstall vips
Then:
yarn clean
yarn install
gatsby develop
if trying some quick command fixes don't work you can try rebuilding the node_modules.
Delete the whole node_modules folder and run npm install
npm install
Upgrading of gatsby-transformer-sharp helped me in my case.
You may need to completely reinstall expo-cli package.
yarn global remove expo-cli
yarn global add expo-cli
OR
npm uninstall expo-cli -g
npm install expo-cli -g
(If you don't have expo-cli installed globally, remove global / -f flags)

create-react-app only creates package.json, package-lock.json and node_modules

This is my first react app.
I'm working on windows 10, node version 10.15.3, npm version 6.4.1.
This when i execute create-react-app command:
C:\Users\hp\Desktop>npx create-react-app app2
npx: installed 91 in 30.086s
Creating a new React app in C:\Users\hp\Desktop\app2.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
+ react-dom#16.8.6
+ react#16.8.6
+ react-scripts#3.0.1
added 1404 packages from 727 contributors and audited 888973 packages in
237.52s
found 0 vulnerabilities
It just get stuck after this I waited for almost 20 minutes but nothing happened ,no success message or information about commands like npm start is displayed and I have to do ctrl+c to terminate the batch job.
The project folder created contains only package.json, package-lock.json and node_modules and package.json file does not have start,build,test and eject script
Can anyone please help me I am not getting what is wrong here
Try to update the npm package:
npm install -g npm
And then install create react app again:
npm install -g create-react-app
And create the project again
I fixed it in three steps:
npm uninstall -g crete-react-app
yarn global add create-react-app
yarn create react-app my-app
It will work!

error: bundling: UnableToResolveError: Unable to resolve module react/lib/ReactComponentTreeHook

Why? Why is react looking here? I have another test android project and it also does not have react package located there, yet it runs perfectly. Why is this one looking here? The only difference is I first did setup a directory below. In MyProject/App is where i did the init. I then moved the index.js files and package.json a level up to top level directory. I want to know the WHY of this error!
Here is the error:
error: bundling: UnableToResolveError: Unable to resolve module
react/lib/ReactComponentTreeHook from /Users/Admin/Projects/MyProject/node_modules/react- native/Libraries/Performance/Systrace.js:
Module does not exist in the module map or in these directories:
/Users/Admin/Projects/MyProject/node_modules/react- native/node_modules/react/lib
, /Users/Admin/Projects/MyProject/node_modules/react/lib
This might be related to https://github.com/facebook/react-native/issues/4968
To resolve try the following:
1. Clear watchman watches: `watchman watch-del-all`.
2. Delete the `node_modules` folder: `rm -rf node_modules && npm install`.
3. Reset packager cache: rm -fr $TMPDIR/react-* or `npm start --reset-cach
All these steps I have tried. They don't fix it. I will probably do another init a level above but still I want to know whey it's looking there. Is there a module map being setup somewhere incorrectly? Where do I look for this?
UPDATE: After doing init properly in the root directory of the app I now get something else:
Loading dependency graph, done.
error: bundling: UnableToResolveError: Unable to resolve module react/lib/ReactDebugCurrentFrame from /Users/Admin/Projects/MyProjectRoot/node_modules/react-native/Libraries/Renderer/src/renderers/shared/stack/reconciler/ReactCompositeComponent.js: Module does not exist in the module map or in these directories:
This leads to suggestions that you need alpha version of react to go along with latest react:
https://github.com/facebook/react-native/issues/13017
But doing this does not work. It just leads back to the same issue I had to begin with about ReactComponentTreeHook.
Again, same suggestions about how to fix it. rm -rf node_modules followed by npm install! But I also did a npm install --save on react react-native. I think I need some response from react-native team on how to properly interpret this kind of error. What's going on here?
Xcode 8.2 still occur same error. Three lines bellow fixed it for me :)
Downgrade react(16.0.0-alpha.12 -> 16.0.0-alpha.6) & react-native(0.45.0 -> 0.44.0)
rm -rf node_modules/react
npm i react#16.0.0-alpha.6 -S
npm i react-native#0.44.0 -S
Then run react-native run-ios
Hope this help.
The problem is that the npm init, npm install --save react -react-native does not install the correct versions. What you need to do is look at the version of react inside package.json In my case it was an alpha.
So right now need to do:
npm install --save react#16.0.0-alpha.6 react-native
but check what's inside your package.json and watch any warning messages carefully
Try install react-native-git-upgrade
$ npm install -g react-native-git-upgrade
and then run
$ react-native-git-upgrade
for me it works.
This error happens when someone upgrade react-native version.
$ npm install -g react-native-git-upgrade
$ npm install react-native#latest --save
$ react-native-git-upgrade
Close all terminals.
Then clear cache. Remove directory ~/Library/Developer/Xcode/DerivedData
In Xcode, Product-> Clean
Then run simulator from Xcode or run code on the attached device again.

Requiring unknown module "ReactInstanceHandles"

Recently updated to React 0.19.0 and have started to get this error.
I've tried cleaning out the gradle folders but I'm still getting the error.
I've also tried restarting the package manager.
I fixed this by
rm -rf node_modules
Remove react from package.json, since react-native now includes it.
npm install