Bundling errors after updating an npm package in React Native app - node.js

I'm building a React Native app which, at this point, doesn't have too many dependencies.
Every time I update an outdated npm package, I am GUARANTEED to run into bundling errors. It could be any package. I then spend hours trying different ways to clear npm cache, project cache, etc.
Does anyone else have this issue? Is there a "standard" set of commands I should run after upgrading ANY npm package? This is extremely frustrating!
This screen shot shows today's flavor of the issue:
BTW, I'm on Windows 10, using VS Code. My React Native version is 0.63.1, Node version is 14.7.0 and npm version is 6.14.7
UPDATE:
After a couple of hours of messing around and removing node_modules folder several times and issuing the following commands a few times, it's now started to work. Unfortunately, I can't put my finger on what fixed it. As I said, I did the same things a few times.
Here are the steps I repeated a few times -- though once should be enough:
Deleted the node_modules folder
In root folder, I ran npm cache clean --force
I then reinstalled all npm packages by running npm i
Went into cd android folder and ran ./gradlew clean
Then in project root, I ran npm start -- --reset-cache
Unfortunately, doing this the first time didn't fix the issue. It looks like I have to waste a couple of hours for things to get back to normal! Any idea how to make this problem go away for good?

I think this error is that you have not start the metro bundle. Try react-native start and then re-run the app

Related

Vite - How to npm run dev when I have deleted both package-lock and package.jason folders?

Im following along a tutorial on YT on how to code and deploy a react website. I created my project using Vite. Everything was reflecting fine on my browser window until I closed the terminal and now my browser returned "This page can't be reached". So I tried running npm run dev one more time and I get a bunch of errors. Looked online for an answer and ended up deleting both the package-lock.json and package.json folders. Now when I run npm install I only get a rather almost empty package-lock.json folder. Is there a way to undo this? I feel like I messed around too much with the terminal. How can I go back to running npm run dev effectively?
You need to install the packages again,
You need to initialize the package again.
I'd suggest going through the source code in order to find out the name of the packages.
npm init
then all you need to do is
npm i pkg1 pkg2 pkg3

Problems installing the expo-cli

I've been trying for the past few hours to install the expo-cli. Half way through installation I keep getting this error:
tarball data for #expo/traveling-fastlane-darwin#1.10.0 (sha512-XXX) seems to be corrupted. Trying one more time.
After a really long time it crashes without expo-cli being installed.
I thought it could be a problem with Node.js. So I reinstalled Node.js and deleted every npm folder I could find. Furthermore cleared the cache with:
npm cache clear --force
Nothing works... Anybody has an idea why I keep getting this error?
Looks like a common windows issue. Have you tried version 3.7.1?
npm i -g expo-cli#3.7.1
Otherwise try to install the linux subsystem and use the linux bash.

Different NPM version used when generating React app

When I try to create the starter React tutorial app using powershell, I get the below error:
"You are using npm 2.15.12 so the project will be boostrapped with an old unsupported version of tools".
"Please update to npm 3 or higher for a better, fully supported experience".
However, my NPM version is 6.11.3 as seen below.
What I have tried:
I have ran powershell as admin as answered in this question and restart.
I have also uninstalled and reinstalled Nodejs completely.
So after an extra hour digging around, I saw a few posts with similar (but not exactly) the same issue. I decided to install Yarn and install with that.
After install, I ran yarn cache clean and ran npx create-react-app your-app and it worked. Sorry for bothering you all.
I had the same problem. I'm running WSL with ubuntu, and yarn cache clear didn't work, but I noticed a node modules directory created in the project. I think it was messing with the node version so I deleted it. It worked

React-Native stuck at Loading dependency graph done. No errors

I have a problem with my app, after running react-native run-android, the procees stop with blank page app at get stuck at loading dependency graph done... nothing happens. Everything was ok and suddenly not work anymore.
I tried everything i found on the internet... still not working. Any ideas?
package.json
This is what i get..
Probably, it might be an issue with watchman. Please try to close all terminals and emulator, clean the project and give the build. It did worked with me when i came across the same situation.
When you’re unable to load a bundle, look at the packager logs or the error message displayed in the Expo client to see if it’s related to the packager. If so, you should try clearing the packager’s state to reduce the chance the bug is related to a stale cache or corrupt process.
These instructions are for macOS and Linux, but the general ideas apply to Windows as well.
Stop XDE/exp, which should also stop the packager. Check your list of running processes to ensure these processes are not running.
Delete node_modules in your project
If your project depends on other local projects (e.g. has a file:
URI in its dependencies), clear those local project’s node_modules
directories too for good measure even though it’s probably
unnecessary.
Clear your Yarn or npm cache, depending on which you’re using, with
yarn cache clean or npm cache clean
Run yarn or npm i to install your dependencies again
Run watchman watch-del-all to clear Watchman’s state
Kill the watchman daemon process
Delete the packager’s cache directory with rm -fr $TMPDIR/metro*
Start XDE or exp
With exp, run exp r -c for good measure
And just to be sure, force quit the Expo client on your phone or simulator and re-open it.
None of the above answers worked for me. I had this issue after transferring my data from my old mac to my new one. It turned out that the brew installed python was not properly transferred. So, basically I uninstalled and reinstalled watchman.
brew uninstall watchman python
brew install watchman
I then restarted the packager, and I was ready to go.

Npm 2.x errors on Windows

I have installed NodeJs 4.2.1 and Npm 2.14.7 successfully on Windows 10 x64, but when at the time of gathering dependencies on my new and clean system I'm having several errors. This is what I have done so far:
I have cloned many examples from take: github https://github.com/developit/express-es6-rest-api to name one, when I run npm install on it everything works fine, but when I run npm start it raises errors for missing packages for instance: babel-core/register, utf8, requests, etc. It seems that npm is not installing the 2nd dependency level way down. How can I fix this?, as I said before I've tried with several tutorials and even with something mine and everything is the same. I need a hand, noob on NodeJS here.

Resources