Impossible to install SQLite on React Native project - sqlite

I'd like to start a new React Native project including SQLite Storagee.
I've already done this before so I know that it should work, but not today...
So I've init a new project in which I installed react-native-sqlite-storage following this step by step tutorial (https://www.npmjs.com/package/react-native-sqlite-storage), the android part.
Everything is fine untill I run my project whith react-native run-android.
Here is my package.json file
{
"name": "pokedex",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"react": "16.8.6",
"react-native": "0.60.5",
"react-native-sqlite-storage": "^4.0.0"
},
"devDependencies": {
"#babel/core": "^7.5.5",
"#babel/runtime": "^7.5.5",
"#react-native-community/eslint-config": "^0.0.5",
"babel-jest": "^24.9.0",
"eslint": "^6.2.2",
"jest": "^24.9.0",
"metro-react-native-babel-preset": "^0.56.0",
"react-test-renderer": "16.8.6"
},
"jest": {
"preset": "react-native"
}
}
Here is the result in my terminal. I don't understand what's going on.
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:preDebugBuild'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
> Could not resolve project :react-native-sqlite-storage.
Required by:
project :app
> Unable to find a matching configuration of project :react-native-sqlite-storage:
- None of the consumable configurations have attributes.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 10s
error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:preDebugBuild'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
> Could not resolve project :react-native-sqlite-storage.
Required by:
project :app
> Unable to find a matching configuration of project :react-native-sqlite-storage:
- None of the consumable configurations have attributes.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 10s
at checkExecSyncError (child_process.js:629:11)
at execFileSync (child_process.js:647:13)
at runOnAllDevices (/home/axel/leclercq.axel#gmail.com/Pokedex/Developpement - AXEL ONLY/V5/pokedex/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:74:39)
at buildAndRun (/home/axel/leclercq.axel#gmail.com/Pokedex/Developpement - AXEL ONLY/V5/pokedex/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/index.js:158:41)
at then.result (/home/axel/leclercq.axel#gmail.com/Pokedex/Developpement - AXEL ONLY/V5/pokedex/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/index.js:125:12)
at process._tickCallback (internal/process/next_tick.js:68:7)
I've tried it with various version of both react-native and sqlite-storage but nothing works.
Need help please

Hey I found the solution!
Just go to your settings.gradle file and change
THIS LINE
project(':react-native-sqlite-storage').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-sqlite-storage/src/android')
TO THIS
project(':react-native-sqlite-storage').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-sqlite-storage/platforms/android')
Greetings!

Same problem :(
Could not determine the dependencies of task ':app:preDebugBuild'.
Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
Could not resolve project :react-native-sqlite-storage.
Required by:
project :app
Unable to find a matching configuration of project :react-native-sqlite-storage: None of the consumable configurations have attributes.

React Native also requires Java SE Development Kit (JDK). I installed it and then just restarted the program and the error was resolved. Hopefully this works for you as well!!
Greetings.

Related

Network service crashed - after command > npx cypress open

How to fix error
[20164:0814/185206.944:ERROR:network_service_instance_impl.cc(470)] Network service crashed, restarting service.
after command > npx cypress open
Founded issue:
The error was on version ^10.5.0
If installing with this version in package.json file it is ok:
"devDependencies": {
"cypress": "^9.7.0"
}
}

When updating Next.js v10.1.13 to webpack5, getting warnings Can't resolve 'fsevents' in chokidar

npm install next react react-dom And running Node.js v12
Created most simple pages/index.tsx
export default function PageHome(props) {
return <>Hello World!</>
}
(I also had TypeScript configured as per Next.js instructions but not sure if that's making a difference.)
C:\GitHub\reproduce-nextjs-webpack5-error>npm run dev
...
event - compiled successfully
<w> [webpack.cache.PackFileCacheStrategy] Caching failed for pack: Error: Can't resolve 'fsevents' in 'C:\GitHub\reproduce-nextjs-webpack5-error\node_modules\next\node_modules\chokidar'
<w> while resolving 'fsevents' in C:\GitHub\reproduce-nextjs-webpack5-error\node_modules\next\node_modules\chokidar to a directory
<w> [webpack.cache.PackFileCacheStrategy] Caching failed for pack: Error: Can't resolve 'fsevents' in 'C:\GitHub\reproduce-nextjs-webpack5-error\node_modules\next\node_modules\chokidar'
<w> while resolving 'fsevents' in C:\GitHub\reproduce-nextjs-webpack5-error\node_modules\next\node_modules\chokidar to a directory
Self-answered solution below for future readers.
Upgrade Node.js
Delete package-lock.json and node_modules
Run npm install again
It works
Apparently something doesn't install when you run with an older Node.js version.
My package.json looked like
{
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start"
},
"dependencies": {
"next": "^10.1.3",
"react": "^17.0.2",
"react-dom": "^17.0.2"
},
"devDependencies": {
"#types/react": "^17.0.3",
"typescript": "^4.2.4"
}
}
The same package.json will install slightly differently switching from Node.js v12 to Node.js v15 as I just observed. This is why you have to complete not just step 1, but also steps 2 & 3.
Before:
C:\GitHub\reproduce-nextjs-webpack5-error>node --version
v12.4.0
C:\GitHub\reproduce-nextjs-webpack5-error>npm run dev
> # dev C:\GitHub\reproduce-nextjs-webpack5-error
> next dev
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
info - Using webpack 5. Reason: future.webpack5 option enabled https://nextjs.org/docs/messages/webpack5
event - compiled successfully
<w> [webpack.cache.PackFileCacheStrategy] Caching failed for pack: Error: Can't resolve 'fsevents' in 'C:\GitHub\reproduce-nextjs-webpack5-error\node_modules\next\node_modules\chokidar'
<w> while resolving 'fsevents' in C:\GitHub\reproduce-nextjs-webpack5-error\node_modules\next\node_modules\chokidar to a directory
After:
C:\GitHub\reproduce-nextjs-webpack5-error>node --version
v15.14.0
C:\GitHub\reproduce-nextjs-webpack5-error>npm run dev
> dev
> next dev
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
info - Using webpack 5. Reason: future.webpack5 option enabled https://nextjs.org/docs/messages/webpack5
event - compiled successfully
event - build page: /
wait - compiling...
event - compiled successfully
Yay! No warnings!
While there are comments below about future changes in nextjs#canary, the above examples worked for me with versions listed.
Delete the .next folder and re-run npm run dev.
This happens when your system shuts down unexpectedly without saving.
I have resolved this problem by killing all node processes on my production server.

react-native build failed after installing admob module

info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1001 file(s) to forward-jetify. Using 4 workers...
info JS server already running.
info Installing the app...
> Configure project :react-native-firebase_admob
:react-native-firebase_admob package.json found at /home/muhamed-kveshkshaano/suck/node_modules/#react-native-firebase/admob/package.json
:react-native-firebase_app package.json found at /home/muhamed-kveshkshaano/suck/node_modules/#react-native-firebase/app/package.json
:react-native-firebase_admob:firebase.bom using default value: 26.3.0
:react-native-firebase_admob:ads.consent using default value: 1.0.6
:react-native-firebase_admob package.json found at /home/muhamed-kveshkshaano/suck/node_modules/#react-native-firebase/admob/package.json
:react-native-firebase_admob:version set from package.json: 10.5.1 (10,5,1 - 10005001)
:react-native-firebase_admob:android.compileSdk using custom value: 29
:react-native-firebase_admob:android.targetSdk using custom value: 29
:react-native-firebase_admob:android.minSdk using custom value: 16
:react-native-firebase_admob:reactNativeAndroidDir /home/muhamed-kveshkshaano/suck/node_modules/react-native/android
> Configure project :react-native-firebase_app
:react-native-firebase_app package.json found at /home/muhamed-kveshkshaano/suck/node_modules/#react-native-firebase/app/package.json
:react-native-firebase_app:firebase.bom using default value: 26.3.0
:react-native-firebase_app:play.play-services-auth using default value: 19.0.0
:react-native-firebase_app package.json found at /home/muhamed-kveshkshaano/suck/node_modules/#react-native-firebase/app/package.json
:react-native-firebase_app:version set from package.json: 10.5.0 (10,5,0 - 10005000)
:react-native-firebase_app:android.compileSdk using custom value: 29
:react-native-firebase_app:android.targetSdk using custom value: 29
:react-native-firebase_app:android.minSdk using custom value: 16
:react-native-firebase_app:reactNativeAndroidDir /home/muhamed-kveshkshaano/suck/node_modules/react-native/android
> Task :react-native-firebase_app:compileDebugJavaWithJavac
> Task :app:processDebugResources FAILED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.2/userguide/command_line_interface.html#sec:command_line_warnings
37 actionable tasks: 29 executed, 8 up-to-date
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource linking failed
/home/muhamed-kveshkshaano/.gradle/caches/transforms-2/files-2.1/820765fbb4c63d086027395fb7f0dacc/play-services-ads-lite-19.6.0/AndroidManifest.xml:27:5-38:15: AAPT: error: unexpected element <queries> found in <manifest>.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 32s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
Note: Some input files use or override a deprecated API.
here is the error, the main problem is each i install admob module #react-native-firebase/admob, it throws this error after trying a lot i couldnt find any solution, it only happens after installing admob module except that it build well, anyone knows whats wrong with that module
I was with the same problem and it work for me
in android/app/build.gradle
defaultConfig {
...
multiDexEnabled true // added for admob problem
}
...
dependencies {
...
implementation "androidx.multidex:multidex:2.0.1" // fix firebaseAdmob
}
in android/build.gradle
dependencies {
classpath('com.android.tools.build:gradle:4.1.2')
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:4.3.3'
}
now open the android folder in Android Studio and wait for gradle will update
when finish the gradle update run npx react-native run-android
downgrade all the rnfirebase libraries that you are using to less than 10.0.0 (admob 7.6.11 and app 9.0.0), as I show in the image

How do I fix deployment error "OSSL_WEBCRYPTO_OR_TEXT_ENCODING_NOT_INSTALLED is not defined" when using ZEIT Now, Next.js, and Gun.js?

I've been unable to deploy a Next.js app via ZEIT Now due to a Gun.js reference error, OSSL_WEBCRYPTO_OR_TEXT_ENCODING_NOT_INSTALLED is not defined. There are no errors when running in development mode on my local machine.
Just prior to the error in the deployment logs is the message "node-webcrypto-ossl and text-encoding may not be included by default, please add it to your package.json!" Doing so did not fix the error, nor did adding #trust/webcrypto as per https://github.com/amark/gun#additional-cryptography-libraries (I'm using SEA for user authentication) (EDIT: removed #trust/webcrypto from dependencies).
Stack trace from Now deployment logs:
Compiled with warnings.
./node_modules/gun/gun.js
Critical dependency: the request of a dependency is an expression
./node_modules/gun/sea.js
Critical dependency: the request of a dependency is an expression
./node_modules/gun/gun.js
Critical dependency: the request of a dependency is an expression
./node_modules/gun/sea.js
Critical dependency: the request of a dependency is an expression
Hello wonderful person! :) Thanks for using GUN, feel free to ask for help on https://gitter.im/amark/gun and ask StackOverflow questions tagged with 'gun'!
node-webcrypto-ossl and text-encoding may not be included by default, please add it to your package.json!
> Build error occurred
ReferenceError: OSSL_WEBCRYPTO_OR_TEXT_ENCODING_NOT_INSTALLED is not defined
at /tmp/173ebd33/.next/serverless/pages/index.js:13474:7
at /tmp/173ebd33/.next/serverless/pages/index.js:13301:7
at /tmp/173ebd33/.next/serverless/pages/index.js:13478:5
at Object.<anonymous> (/tmp/173ebd33/.next/serverless/pages/index.js:14596:2)
at Object.md/m (/tmp/173ebd33/.next/serverless/pages/index.js:14597:30)
at __webpack_require__ (/tmp/173ebd33/.next/serverless/pages/index.js:23:31)
at Object.1TCz (/tmp/173ebd33/.next/serverless/pages/index.js:865:11)
at __webpack_require__ (/tmp/173ebd33/.next/serverless/pages/index.js:23:31)
at Module.VVmT (/tmp/173ebd33/.next/serverless/pages/index.js:11281:12)
at __webpack_require__ (/tmp/173ebd33/.next/serverless/pages/index.js:23:31)
at /tmp/173ebd33/.next/serverless/pages/index.js:91:18
at Object.<anonymous> (/tmp/173ebd33/.next/serverless/pages/index.js:94:10)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
npm
ERR! code ELIFECYCLE
npm
ERR! errno 1
npm
ERR! maptivist#1.0.0 now-build: `next build`
npm ERR!
Exit status 1
npm ERR!
npm ERR! Failed at the maptivist#1.0.0 now-build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
package.json dependencies:
{
"dependencies": {
"directory-named-webpack-plugin": "^4.0.1",
"gun": "^0.2019.726",
"mapbox-gl": "^1.2.1",
"next": "^9.0.3",
"next-offline": "^4.0.3",
"node-webcrypto-ossl": "^1.0.48",
"react": "^16.9.0",
"react-dom": "^16.9.0",
"styled-components": "^4.3.2",
"text-encoding": "^0.7.0"
}
}
node-webcrypto-ossl-related stuff in package-lock.json:
...
"gun": {
"version": "0.2019.726",
"resolved": "https://registry.npmjs.org/gun/-/gun-0.2019.726.tgz",
"integrity": "sha512-LVSxhGwaemZbrirSk6fp2KXORLUyjs6bnssjSjl/OhwbfLv7fvMhNfaOZuorzYsehxqMKJvxyNdFq/mZNXpjHQ==",
"requires": {
"emailjs": "^2.2.0",
"node-webcrypto-ossl": "^1.0.47",
"text-encoding": "^0.7.0",
"ws": "~>7.1.0"
}
},
...
"node-webcrypto-ossl": {
"version": "1.0.48",
"resolved": "https://registry.npmjs.org/node-webcrypto-ossl/-/node-webcrypto-ossl-1.0.48.tgz",
"integrity": "sha512-MWUkQ/5wrs7lpAr+fhsLMfjdxKGd3dQFVqWbNMkyYyCMRW8E7ScailqtCZYDLTnJtU6B+91rXxCJNyZvbYaSOg==",
"requires": {
"mkdirp": "^0.5.1",
"nan": "^2.13.2",
"tslib": "^1.9.3",
"webcrypto-core": "^0.1.26"
}
},
...
node-webcrypto-ossl is visible in node_modules.
Please help! :-)
#randy-morantes your package.json looks correct.
Could you try to share:
The stacktrace of the error.
Your server code that calls gun that causes this problem.
I am an author of the peculiar\webcrypto and node-webcrypto-ossl packages. Based on the source of gun:
https://github.com/amark/gun/blob/e0d85f02b567a43d39cda0fe71522b84ff52a08b/sea/shim.js#L25
It looks like they have not switched to peculiar\webcrypto yet. Try adding node-webcrypto-ossl to your package.json.
The latest version of Next.js ("next": "9.0.4", "next-offline": "4.0.5") fixed the issue!
I've encountered this problem last night and finally successfully fixed it using some monkey-patch and hack around. The trick is taking gun and sea out of the webpack and react environment, then access it using window.gun. Also, gun seems running faster when it is not in webpack.
This is how I did it in my Gatsbyjs project:
Read this doc: https://www.gatsbyjs.org/docs/custom-html/
Copy ./cache/default-html.js to ./src/html.js
Now start gun and sea in the of html.js. You can load external js file from github or jsdelivr here.
Then in your gatsby react components, just call window.gun and window.user and enjoy hacking:
if (window) gun...
Now run gatsby build and you can see it is built without error.

AWS Lambda Error: Failed to load gRPC binary module because it was not installed for the current system

I have problem with AWS Lambda function deployment with Serverless Framework. I use #google-cloud-firestore npm package which requires grpc package.
Function execution throws error:
{
"errorMessage": "Failed to load gRPC binary module because it was not installed for the current system\nExpected directory: node-v48-linux-x64-glibc\nFound: [node-v59-darwin-x64-unknown]\nThis problem can often be fixed by running \"npm rebuild\" on the current system\nOriginal error: Cannot find module '/var/task/node_modules/grpc/src/node/extension_binary/node-v48-linux-x64-glibc/grpc_node.node'",
"errorType": "Error",
"stackTrace": [
"Found: [node-v48-linux-x64-unknown]",
"This problem can often be fixed by running \"npm rebuild\" on the current system",
"Original error: Cannot find module '/var/task/node_modules/grpc/src/node/extension_binary/node-v48-linux-x64-glibc/grpc_node.node'",
"Object.<anonymous> (/var/task/node_modules/grpc/src/grpc_extension.js:44:17)",
"Module._compile (module.js:570:32)",
"Object.Module._extensions..js (module.js:579:10)",
"Module.load (module.js:487:32)",
"tryModuleLoad (module.js:446:12)",
"Function.Module._load (module.js:438:3)",
"Module.require (module.js:497:17)",
"require (internal/module.js:20:19)",
"Object.<anonymous> (/var/task/node_modules/grpc/src/client.js:38:12)",
"Module._compile (module.js:570:32)",
"Object.Module._extensions..js (module.js:579:10)",
"Module.load (module.js:487:32)",
"tryModuleLoad (module.js:446:12)",
"Function.Module._load (module.js:438:3)",
"Module.require (module.js:497:17)",
"require (internal/module.js:20:19)"
]
}
So, as I understood, lambda requires grps built with target node-v48-linux-x64-glibc
Typing npm i -S grpc --target=6.4.0 --target_arch=x64 --target_platform=linux has only changed node-v59-darwin-x64-unknown to node-v48-linux-x64-unknown.
How can I change unknown to glibc?
Any help would be really appreciated!
Fix
Basically, you need to specify the target of the grcp library.
Copied from that link:
{
"main": "index.js",
"scripts": {
"postinstall": "npm rebuild grpc --target=6.1.0 --target_arch=x64 --target_platform=linux --target_libc=glibc"
}
}
I got something similar to work by including a --target_libc=glibc, found in the documentation for node-pre-gyp.

Resources