node_modules/react-native-linear-gradient/common.jsAttempted import error: 'requireNativeComponent' is not exported from 'react-native-web/dist/index' - react-native

Error in the Terminal
Code Fragment
I've got trouble with the usage of linear-gradient in React-Native. I've installed everything right but this error always pops up. Can someone help?

Uninstall the library you are using and use this library for linear gradient that is under react-native-community.
https://github.com/react-native-community/react-native-linear-gradient

Related

Requiring unknown module "3"

Requiring unknown module "3". If you are sure the module exists, try restarting Metro. You may also want to run 'yarn' or 'npm intall'.
Any one can help me with this erro on react-native. I'm using vscode and android studio.
Firstly, I encountered the same error message. Then I needed to solve the problem which occurred when I changed the folder structure, influences paths of imported files after I ran the app (on runtime). Actually the error message gives us the cause of the problem but I slogged on handling this error as a newbie on React Native. Frankly, the problem we have faced is about the packager as far as i have learnt.
It’s all about how the packager works. Packaging happens once before runtime so those variables don't have values yet.
Variables are components we have imported from other files in our situation.
The packager only works with statically analyzable “imports”. Treat “import” like a keyword.
As an example, let’s imagine you have folders in the root path of your project. If you run your Android Emulator, then packaging is carried through by Gradle under the hood.
import styles from './styles'
import StepCurrent from './images/stepcurrent.png'
import StepDone from './images/stepdone.png'
import StepNext from './images/stepnext.png'
Then if you try to change folder structure and call these components from another path, error occurs because packaging happened at the first phase, running the emulator, before your changes. Emulator does not read your current file paths.
import styles from './exampleFolder/styles'
import StepCurrent from './exampleFolder/images/stepcurrent.png'
import StepDone from './exampleFolder/images/stepdone.png'
import StepNext from './exampleFolder/images/stepnext.png'
So, you can restart your emulator to restart your packager. Then the problem disappears.
References:
The packager only works with statically analyzable 'requires'.
Packaging happens once before runtime.
Solution way is to restart packager.
My solution is reset metro server.
yarn start --reset-cache

Unable to resolve module `../../screens/AuthScreen` from `src\screens\Welcome\Welcome.js`

I'm new at react-native and try to build an app. When I run my code I'm getting this error:
As you can see the path, my code is correct. I don't understand why I'm getting this error, can anyone help?
import AuthScreen from '../AuthScreen/AuthScreen';

Using styleguidist in a react native application

I'm trying to use styleguidist in a react native application application;
I come across this link and implemented the exact same set up in my application:
https://github.com/styleguidist/react-styleguidist/tree/master/examples/react-native
After running npx styleguidist build, i got this output:
FAIL Failed to compile
build/bundle.f44bbfd4.js from UglifyJs
Unexpected token punc «:», expected punc «,» [build/bundle.f44bbfd4.js:372,1165]
Any ideas how to solve this ?
Thanks in advance.
Can you please provide more examples of what exact code changes you made and to what files? I had a similar issue and it turned out I was applying config changes to webpack.config.js that needed to go into the styleguide.config.js instead.

OpenAI Gym error running demo from intro page

I installed OpenAI Gym and attempted to run the getting-started cart-pole demo (https://gym.openai.com/docs/). (I'm running in a Colab notebook.)
import gym
env = gym.make('CartPole-v0')
env.reset()
for _ in range(1000):
env.render()
env.step(env.action_space.sample()) # take a random action
This doesn't learn, but it should display the cart and pole.
When I run it I get a warning and an error.
WARN: gym.spaces.Box autodetected dtype as <class 'numpy.float32'>. Please provide explicit dtype.
The error is triggered by env.render(). At the bottom of the Traceback is
Error occured while running `from pyglet.gl import *`
The original exception was:
ImportError: Library "GL" not found.
I had installed pyOpenGL with the following.
!pip install PyOpenGL PyOpenGL_accelerate
I'd appreciate help with both the warning and the error. Is there another GL library I should install?
Thanks.
Google Colab is run in the cloud. It can't send the graphic display back to your monitor.
You can try running it with local runtime.
https://research.google.com/colaboratory/local-runtimes.html
Do you get this window?
If yes then try to add this import:
import time
and this line of Code within the for-loop:
time.sleep(0.3)
Thing is that the pole runs out of view rather quick, so it seems like
the Environment did not run at all.

Deploy Qt3D project for Android under win 7

I've successfully deployed the cube example APK by creating a new Quick 2 project and copy qml file there, but got "module "Qt3D" plugin "qthreedqmlplugin" not found" error message, any clue for this? I already place the so file into imports/Qt3D folder, but no success. Thanks.
Edit: I tried using Qt 5.1.1 and followed the Qt3D installation described here (http://qt-project.org/wiki/Qt3D-Installation) , and can get rid of the plugin not found error message above. But, this time, a message of “library “libQt53DQuick.so” not found” show up as follows:
W/Qt (29930): assets:/qml/3dCube/main.qml:2 (): assets:/qml/3dCube/main.qml:2:1: plugin cannot be loaded for module "Qt3D": Cannot load library /data/data/org.qtproject.example.test3D/qml/Qt3D/libqthreedqmlplugin.so: (Cannot load library: soinfo_link_image(linker.cpp:1635): could not load library "libQt53DQuick.so" needed by "libqthreedqmlplugin.so"; caused by load_library(linker.cpp:745): library "libQt53DQuick.so" not found)
The problem been solved! After adding the following line in my .pro file:
QT += qml quick 3dquick
The example works well in my sony android phone with adreno gpu, but not in my new lenovo yoga 8" with PowerVR gpu which I'll look into later.
Edit: BTW I eventually use QT5.2.1 for building my example.
That's because in Qt 5.3 there was no way to figure out the plugin dependencies of qml imports. In 5.4, we have the qml import scanner that avoids the need to edit your .pro files to mention qml import dependencies.