Cant use 'fs' in my react-native project.. don't know how to solve - reactjs

Hi im trying to use the fs.createReadStream() function in 'fs' however i cant seem to use this module as i keep getting this build error.
bundling failed: Error: While trying to resolve module fs from file /Users/bentait/Desktop/memriio/memriio_app/src/datapass.js, the package /Users/bentait/Desktop/memriio/memriio_app/node_modules/fs/package.json was successfully found. However, this package itself specifies a main module field that could not be resolved (/Users/bentait/Desktop/memriio/memriio_app/node_modules/fs/index.js. Indeed, none of these files exist:
Im almost at my end trying to learn js, react, react-native.. i seem to spend 90% of time trying to solve these sorts of problems and 10% of time writing actual code..
anyway - not really expecting a response on this but cool, if you know how to help..

You're not able to use node's fs because it is part of nodejs environment. As you surely know your application code is not running on nodejs but rather directly on your smartphone (besides debug mode but even there you cannot use node's fs package).
To access and manipulate smartphone's filesystem take a look at react-native-fs or rn-fetch-blob package.

Related

My t3 app wont build. Module not found: Can't resolve 'v8

Let me start off by saying i'm really new to this, so this might be obvious to some of you...
I am trying to build my NextJS project but it fails to compile. The errors i'm getting are the following:
./node_modules/openid-client/lib/helpers/deep_clone.js
Module not found: Can't resolve 'v8' in ....
and
./node_modules/openid-client/lib/helpers/keystore.js
Module not found: Can't resolve 'v8' in...
Both input traces end on the /server/auth.ts file which leads me to suspect that I have messed up the next auth implementation somewhere, but the issue is that i have not added anything beside the boilerplate provided by the t3 stack (besides the env variables and providers).
Thank you very much for your time!
This is the first time i tried to build the project. Everything works fine in dev mode

React suddenly responding with index.html instead of javascript imports

Recently I've been unable to load javascript scripts to my webworkers in react for some reason. It always responds with index.html.
My config is simply a standard create-react-app app. The screenshots are from my actual project but I have confirmed that the problem persists if I create a new project and try to initialize a minimal example.
Each ffmpeg.* file is affected. This is also not specific to ffmpeg since another library had the same issue - thankfully the initialization of that library is simpler so I was able to simply put that libraries worker-file in the public folder - and that worked.
It might be a stupid question but I'm really at my wits end here and I can't figure out how to investigate further.
Thank you <3
EDIT:
It works if I put all the files it is trying to hit in the public folder - so it has to be some kind of context issue(??) This seems like a really stupid way to go about it. It's not in a worker at the point of loading - it's the worker loader that fails to access the stuff it needs in the node_modules folder, (core script, worker script and wasm code). Whet?

Flask-Uploads Module

I am using Python 3.8.2. I am trying to create a project by using the Flask-Uploads module.
When I try to run it, I get error:
"no module named flask.ext.uploads"
I then tried to install this module again with upper case letters like Flask-Uploads, but I still have the same problem.
I was wondering if there's a problem with the latest Python version I am using?
This looks like you have a too old Flask-Uploads version.
Flask-Uploads has not seen an update on PyPi since 2016.
I created a fork of the library, in order to fix some errors and continue development:
https://pypi.org/project/Flask-Reuploaded/
You can use the new library as a drop-in replacement, that means, you do not have to change a single line of code.
Also, you have to import from flask_uploads instead of the obsolete flask.ext.uploads.

Permanently resolve Unable to watch for file changes in this large workspace

To resolve this issue I got there to the link provided by vscode
https://code.visualstudio.com/docs/setup/linux#_visual-studio-code-is-unable-to-watch-for-file-changes-in-this-large-workspace-error-enospc
Ok, this, corrects the error, But when I restart the Linux and again open my React project,
I get the Same error.
max_user_watches file again gets the value of 8192 as no. of max files.
My react server is not starting due to this issue.
Then I again follow the same step of the link provided, this sometimes gets frustrating.
Any permanent Help I could get from you.
A workaround:
Just disable this built-in extension: TypeScript and JavaScript Language Features

Ionic 2 angular-2-in-memory-web-api 404 error

I've been developing a simple app in Ionic 2 and I tried using mock service (in-memory web API) for fetching data as described in this Angular 2 tutorial. My console reported this error:
TypeScript error: app/app.ts(11,49): Error TS2307: Cannot find module
'angular2-in-memory-web-api'.
I tried this solution: angular2-in-memory-web-api 404 error. After running this: npm i angular2-in-memory-web-api --save, I was unable to find the files where I was supposed to use the code provided in the rest of the solution.
How can I fix this? Sorry if the question is not posed quite right, this is my first one. Please ask if any additional information is needed. The problem is pretty much the same as the one for which the solution was provided in the link above, except that using Ionic 2 makes the given solution inapplicable in my case. I'm don't think SystemJS is being used, please see my file structure image.
Image of my file structure.

Resources