Error on running react-native run-android: "Unable to load script" - react-native

I did a first project on react-native, that still works when I want to emulate it on my AVD.
I started a react-native init new project that installed correctly but impossible to run it the first time, Node JS command open and shut down in a seconde. And, come to this point :
"Starting: Intent { cmp=com.ms/.MainActivity }"
Nothing happens : the following line is this one : PS C:\Users\arthu\MS>
And I get the error message : "Unable to load script. Make sure you either running a metro server (run react-native' start) or that your bundle 'index.android.bundle' is packaged correctly for release.
Thought it was due to the Node JS console, which was opening a few second, so I emptied its cache, didn't change anything, Re-installing Node JS, re-tried with my ancient project (which works), change port from where I run the project, nothing changed.
I guess it is not linked with Node JS, neither my code (because I didn't even start), but I am a bit confused about that, and didn't find a similar post ! Thank you for your answers ;)

Related

how to solve module build failed after changing file extension ( *.ts => *.tsx )?

after changing a specific file's extension from .ts to .tsx I get:
Compiled with problems:X
ERROR in ./src/components/SomeComp/someFile.ts
Module build failed (from ./node_modules/source-map-loader/dist/cjs.js):
Error: ENOENT: no such file or directory, open '.../someFile.ts'
ERROR
No files matching 'C:\Users...\src\components\SomeComp\someFile.ts' were found.
it has happened recently and somehow figured out on its own,
then i switched branches and when returned it happened again
I tried what was suggested here, clearing the browser cache How to get Chrome to reload source maps?
also restarted the react dev server couple of times
but still it tries to find the file with the old .ts extension...
searched as much as I could but didn't find a solve...
edit:
after changing the extension back and forth and restarting the dev server it has figured out, but I would still love to know what was happening and what perhaps what should be done to handle this situation correctly in the future

Network calls failing instantly in React Native Windows project

first off apologies if I've forgotten to include anything, new here! I am having a pretty odd issue using react-native-windows version 0.63.0-0 with react-native version 0.63.2. The problem is that network calls made from my windows laptop appear as if they are not attempting to execute... period. They fail instantaneously and simply return a TypeError.
TypeError: Network request failed
This happens to me on a completely fresh init of RN/RNW, and I've tested with a couple http libraries and variations of calls, such as swapping in axios for fetch all using the same then and catch logic (excluded on some examples below for brevity's sake). I have tried and failed to reach several different domains. The API I'm attempting to reach is available (tested successfully with postman). Other standard React-Native projects work just fine from my laptop. I've cleared metro, run --reset-cache, removed tmp, reinstalled node-modules, everything standard you're supposed to try to troubleshoot like that.
fetch('https://subdomain.domain.com/<api-path>', { // my example then & catch
method: "GET",
headers: { "Content-Type": "application/json" }
})
.then(response => response.json())
.then(responseData => console.log(responseData))
.catch(error => console.log(error));
fetch('https://subdomain.domain.com/<api-path>'); // without headers this time, used same then & catch block
axios.get('https://subdomain.domain.com/<api-path>'); // again used same then & catch
// ... and so on, triggering the catch block instantly, as if it fails without trying
I do also see the following error in my debugger console, even though I can see the debuggerWorker from within my 'chrome dev tools -> sources -> page' panel which from what I understand, the error just has to do with chrome not handling source maps correctly, feel free to correct me there. However I'm unsure whether they are even related or if this one is just a fluke:
Error: Unable to resolve module `./debugger-ui/debuggerWorker.cff11639.js` from ``: ./debugger-ui/debuggerWorker.cff11639.js could not be found within the project.
If you are sure the module exists, try these steps:
1. Clear watchman watches: watchman watch-del-all
2. Delete node_modules: rm -rf node_modules and run yarn install
3. Reset Metro's cache: yarn start --reset-cache
4. Remove the cache: rm -rf /tmp/metro-*
at ModuleResolver.resolveDependency (C:\Users\...\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:186:15)
at ResolutionRequest.resolveDependency (C:\Users\...\node_modules\metro\src\node-haste\DependencyGraph\ResolutionRequest.js:52:18)
at DependencyGraph.resolveDependency (C:\Users\...\node_modules\metro\src\node-haste\DependencyGraph.js:287:16)
at C:\Users\...\node_modules\metro\src\lib\transformHelpers.js:267:42
at Server.<anonymous> (C:\Users\...\node_modules\metro\src\Server.js:841:41)
at Generator.next (<anonymous>)
at asyncGeneratorStep (C:\Users\...\node_modules\metro\src\Server.js:99:24)
at _next (C:\Users\...\node_modules\metro\src\Server.js:119:9)
Generally I'll run npx react-native run-windows (or npx react-native start --reset-cache separately first) to execute the project, but debugging from VS Code's debug pane, as well as running from Visual Studio produce the same errors.
Is there something I am missing with my react native windows setup? I have followed the windows setup step by step several times and even simply adding an http request to execute from their default app instantly fails... This has blocked me for a while and it really feels like an environment setup issue, but I'm not sure what else I would check in Visual Studio/my configs in order to resolve this.
After some more continuously banging my head against this issue, I continued to dig a little further into Visual Studio's side. I went file by file looking for anything remotely related to what might be blocking this functionality. As I expected, it was an unfortunately simple solution to something that caused me a significant headache since I wasn't aware of it and could not find it anywhere else, so let this be a lesson to those after me who have network problems with React-Native-Windows:
Whenever you are beginning - or picking up - a RNW project that uses the network to send or retrieve information, make sure that you have first gone into Visual Studio (not VScode) and enabled the "Private Networks (Client & Server)" option. You can find this if you open your project in Visual Studio, and it's under
Project Solution -> 'Package.appxmanifest' file -> 'Capabilities' section
This should hopefully cause your network requests to succeed as you would expect from now on.

“Page Not Found” when navigating to site created with Gridsome & deployed on Netlify

I've created a new site using Gridsome deployed with Netlify, but I can't get the site to appear when accessed. Instead, Netlify says:
Page Not Found
Looks like you've followed a broken link or entered a URL that doesn't exist on this site.
< Back to our site
I tried updating my build settings based on the instructions of the creator of the Gridsome starter template I'm using, but the site still doesn't display. I've also updated the js-yaml version.
I've gone through the questions/answers for similar questions on here, but I haven't been able to figure this out. I'm new to web development, and I'm sure I'm missing one or more things contributing to the issue.
My GitHub repo for this site.
The site.
I have the build log from Netlify. There are some errors in it. I don't want to put too much here, so here's a part from the end of the log.
12:18:36 PM: failed during stage 'building site': Build script returned non-zero exit code: 1
12:18:36 PM: Error running command: Build script returned non-zero exit code: 1
12:18:36 PM: Failing build: Failed to build site
12:18:36 PM: Finished processing build request in 55.729813394s
A Gist for the whole build log.
Thanks so much for your help, #talves!
I was having trouble using the build commands because of being new to cli stuff and a permissions issue. I asked a friend about the build errors I was getting from Netlify, and he recommended I try removing and re-installing my node modules. Did that, still didn't work. I tried removing anything in the repo having to do with "journal" since Failed to render /journal kept appearing in the build log, but that didn't work either.
I googled ReferenceError: _objectSpread is not defined after update since that was in the build log after the journal error. I found a comment on an issue noting the same error message in the main Babel GitHub repo that suggested adding the following to the package.json file:
"resolutions": {
"#babel/core": "^7.5.4"
}
I added it, tried to build again, and it still failed but only gave me one error message it didn't show before—Error: SyntaxError: Unexpected string in JSON at position. I googled that message and got another issue on GitHub. A comment on the issue noted a missing comma.
I went back to my package.json file and found that I didn't add a comma to the bracket above the new "resolutions" snippet. I added the comma, tried to build again, and it worked 🤜💥✨ !
Sorry if this is long-winded! I thought it might be good to include my process on figuring this out in case others run into the same issues.

Error: Cannot find entry file ./node_modules/react-native-scripts/build/bin/crna-entry.js in any of the roots:

I keep receiving this error when running my App.js for React Native that was working perfectly well before I attempted installing Victory charts. Somehow something broke and after over three hours of work I am unable to figure out a solution. I have tried everything I could find on the web including uninstalling watchman, reinstalling watchman, reverting to React Native 0.55.4, some other recommended commands. Nothing is working.I am so confused.
$ yarn add react-native-scripts
This helped.
I think the other library may hurt the installation part of your package. To solve this issue on IOS you need to add its library like below:
First do 'yarn add react-native-scripts'. In the case that it dose't work continue other steps.
1-Go to the node module of your project and find the package folder and find the ios file inside it.
2- Then drag it into ‘library’ section of your xcode. (It is the subset of your project folders)
3- Then go to ‘build phase’ and in the ‘Link binary with libraries’ add it there by clicking on the plus sign
4- Then in some cases you need to add the correct path of the ios file inside your node module in the xcode. To do that you should go to ‘build setting’ section in the xcode and search header there. Then you need to add the path there below other paths.
5- Then clear everything (cmd+shift+k) and then finally compile it.
I hope it works for you.
In my case the "crna-entry.js" file does exist in the roots and my project should work (nothing have been modified from last time when it does work).
After hours searching, finally I figured out the reason:
the packager's directory checking is case-sensitive and in windows terminal the drive "c:/" will not be auto-corrected to "C:/" which will lead to error.
Hope this will help someone who gets the same error.
Below is the full error message:
The development server returned response error code:404 Cannot find
entry file node_modules/react-native-scripts/build/bin/crna-entry.js
in any of the roots:

Could not copy the file "resources.dll" because it was not found

I'm getting this error after clicked for the first time in TEST-> Debug -> All Tests
I've been looking and seen something to add Pre build events but it didn't worked out, the error code:
Error 1 Could not copy the file "obj\Debug\qps-ploc\Bigbuilder.resources.dll" because it was not found. Bigbuilder
The program doesn't debug at the first try but when it asks "there was build errors. Would you like to run the last successfull build?" if i click no and retry to execute it will say nothing but the error will mantain in the error list
Uninstall the Multilingual App Toolkit from Programs and Features, download the latest version, and re-install. This fixes the build issues.
Encountered the same problem with building a console application using the Multilingual App Toolkit in a Portable Class Library, and now it is working.