How to handle "RNGestureHandlerRootViewManager.java" file errors - javascript

I am trying to install my app on my android device with "react-native run-android", but after installing "react-native-gesture-handler" I got an error "FAILURE: Build failed with an exception" and got 15 errors in "RNGestureHandlerModule.java" in the node_modules folder.
I tried many times to link gesture handler. But nothing change appears in the errors.
/projects/gitlabstyleseject/kono-app-styles/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootViewManager.java:4: error: package com.facebook.react.module.annotations does not exist
import com.facebook.react.module.annotations.ReactModule;
^
/projects/gitlabstyleseject/kono-app-styles/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootViewManager.java:17: error: cannot find symbol
#ReactModule(name = RNGestureHandlerRootViewManager.REACT_CLASS)
^
symbol: class ReactModule
/projects/gitlabstyleseject/kono-app-styles/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.java:16:
error: package com.facebook.react.module.annotations does not exist
import com.facebook.react.module.annotations.ReactModule;
^
Task :react-native-gesture-handler:compileDebugJavaWithJavac FAILED
uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
15 errors
Please, suggest me how to solve these errors. And I am new to react native.

Related

Error: Can't resolve 'net' after adding the rabbitode package to my React app

Just added rabbitode to my React TypeScript app so I can read from RabbitMQ. The instructions are quite straightforward, however, I hit a number of issues after installation. My module doesn't compile at all. There were a number of issues related to my using webpack 5, as described here this answer. Most of these could be resolved with the provided answer (util, buffer and querystring-es3) but I'm getting no joy with stream-browserify. Also, there are a couple of errors that I can't track down at all:
ERROR in ./node_modules/rabbitode/node_modules/amqplib/lib/connect.js 155:11-33
Module not found: Error: Can't resolve 'net' in 'c:\myapp\node_modules\rabbitode\node_modules\amqplib\lib'
ERROR in ./node_modules/rabbitode/node_modules/amqplib/lib/connect.js 157:11-33
Module not found: Error: Can't resolve 'tls' in 'c:\myapp\node_modules\rabbitode\node_modules\amqplib\lib'
The lines the error is about are:
if (protocol === 'amqp:') {
sock = require('net').connect(sockopts, onConnect);
}
else if (protocol === 'amqps:') {
sock = require('tls').connect(sockopts, onConnect);
}
else {
throw new Error("Expected amqp: or amqps: as the protocol; got " + protocol);
}
Thought this could be related to my node version as net and tls are available libraries
according to the docs but the issue remains.
Any idea about how to fix it??
Also, the stream error is:
ERROR in ./node_modules/rabbitode/node_modules/amqplib/lib/connection.js 18:13-37
Module not found: Error: Can't resolve 'stream' in 'c:\myapp\node_modules\rabbitode\node_modules\amqplib\lib'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "stream": require.resolve("stream-browserify") }'
- install 'stream-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "stream": false }
That I tried resolving by running npm install stream-browserify and adding stream: require.resolve("stream-browserify"), to the the fallback object in the webpack config. Why would this not work??
UPDATE
I think the problem is related to a couple of key facts:
I bootstrapped my application with the create-react-app and therefore by webpack config was ignored
rabbitode is relying on packages that were not meant for browser use.
I think the solution here is to look for a library that is more fit for purpose (or add an SseEmitter into my SpringBoot backend that reads from the queue, then read its contents in the client via an EventSource
I'm the author of the package, unfortunately it's not meant for use on frontend applications it's meant for node.js servers.
If you did find a workaround to get it working on the frontend I'd love to hear it and I'll see if I can add native support to it :)
Thanks
Evan

Can get a prisma graphql to compile

When I run npm run dev I get this error and I have no idea what is causing it
I have installed all the packages and reinstalled them.
I have applied all of the migrations.
I have re-cloned the repo and done all the steps again and I cant seem to get past this error.
Error: Upload was already defined and imported as a type, check the docs for extending types
at extendError (C:\Users\coope\dev\paypixl\backend\node_modules\nexus\src\builder.ts:1743:10)
at SchemaBuilder.addType (C:\Users\coope\dev\paypixl\backend\node_modules\nexus\src\builder.ts:602:15)
at C:\Users\coope\dev\paypixl\backend\node_modules\nexus\src\builder.ts:1696:14
at C:\Users\coope\dev\paypixl\backend\node_modules\nexus\src\utils.ts:147:41
at Array.forEach (<anonymous>)
at eachObj (C:\Users\coope\dev\paypixl\backend\node_modules\nexus\src\utils.ts:147:20)
at SchemaBuilder.traverseArgs (C:\Users\coope\dev\paypixl\backend\node_modules\nexus\src\builder.ts:1693:12)
at SchemaBuilder.maybeTraverseOutputFieldType (C:\Users\coope\dev\paypixl\backend\node_modules\nexus\src\builder.ts:1688:12)
at Object.addField (C:\Users\coope\dev\paypixl\backend\node_modules\nexus\src\builder.ts:1640:29)
at ObjectDefinitionBlock.field (C:\Users\coope\dev\paypixl\backend\node_modules\nexus\src\definitions\definitionBlocks.ts:712:22)
[ERROR] 10:03:59 Error: Upload was already defined and imported as a type, check the docs for
extending types

Vite disk cache issue

I have a project that uses vite and vue 3 for front end. It also uses eslint. Sometimes when I run the code, it throws me errors like this:
2:26:53 PM [vite] Internal server error: /path/to/project/wt-frontend-2/src/pages/school-districts/PageSsDetails.vue
46:1 error "#/assets/images/school.svg" import should occur before import of "./components/SdDoughnutChart.vue" import/order
✖ 1 problem (1 error, 0 warnings)
1 error and 0 warnings potentially fixable with the "--fix" option.
Plugin: vite:eslint
File: /path/to/project/wt-frontend-2/src/pages/school-districts/PageSsDetails.vue
at formatError (/path/to/project/wt-frontend-2/node_modules/vite/dist/node/chunks/dep-76613303.js:36769:46)
at TransformContext.error (/path/to/project/wt-frontend-2/node_modules/vite/dist/node/chunks/dep-76613303.js:36765:19)
at TransformContext.transform (/path/to/project/wt-frontend-2/node_modules/vite-plugin-eslint/dist/index.js:87:14)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async Object.transform (/path/to/project/wt-frontend-2/node_modules/vite/dist/node/chunks/dep-76613303.js:36985:30)
However, once I fix the code and save, it does not detect the updated file. (it does automatically run though).
Is there a way I could resolve this?
I tried deleting node modules and yarn-lock and running yarn to install the modules, but the issue persists.
This seems to be a known problem with the vite-eslint-plugin.
You can disable the cache in your vite.cofig file with the following line:
eslintPlugin({ cache: false });

Getting "Unknown Option" error running JHipster generated frontend with "npm start"

Whenever I run my default JHipster project (I only changed some code on the backend and made a few styling changes), I get the following error:
[webpack-cli] Error: Unknown option '--inline'
[webpack-cli] Run 'webpack --help' to see available commands and options
Already ran sudo npm i -S webpack#latest to ensure I'm using a new webpack version.
If I remove --inline from the commands, I get a different error:
1% setup initialize[webpack-cli] Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
options has an unknown property 'watchOptions'. These properties are valid:
object { allowedHosts?, bonjour?, client?, compress?, devMiddleware?, headers?, historyApiFallback?, host?, hot?, http2?, https?, ipc?, liveReload?, magicHtml?, onAfterSetupMiddleware?, onBeforeSetupMiddleware?, onListening?, open?, port?, proxy?, setupExitSignals?, static?, watchFiles?, webSocketServer? }
Little bit confused here as I haven't setup the project and also not touched webpack in a while - appreciate any help and thanks in advance!
It was simply a version dependency mismatch. For some reason, the Webpack Config was not defined for the same version as the as the one installed (v4 vs v5 respectively) - I simply assumed that the package json settings would prevent this from happening.
I went through each error using the webpack docs and upgraded it according to the migration instructions.

unable to run the react-native-background-task. error while inserting code to MainApplication.java

One manual step is still needed - in your project file android/app/src/main/java/myapp/MainApplication.java, add the following to the end of the onCreate() method:
BackgroundTaskPackage.useContext(this);
Task :app:compileDebugJavaWithJavac FAILED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.5/userguide/command_line_interface.html#sec:command_line_warning
23 actionable tasks: 2 executed, 21 up-to-date
G:\background\android\app\src\main\java\com\background\MainApplication.java:19: error: cannot find symbol
return BuildConfig.DEBUG;
^
symbol: variable BuildConfig
G:\background\android\app\src\main\java\com\background\MainApplication.java:47: error: cannot find symbol
BackgroundTaskPackage.useContext();
This can be solved in React Native 0.61 by manually linking the module (and disabling auto-linking for the package: https://github.com/react-native-community/cli/blob/master/docs/autolinking.md)

Categories

Resources