React-native-reanimated: Unable to resolve "./useValue" - reactjs

I am trying to build a react native app. I have caught an error on the terminal saying
Unable to resolve "./useValue" from "node_modules\react-native-reanimated\src\Animated.js"
I reinstalled react-native-reanimated to the expected version range.
`Some of your project's dependencies are not compatible with currently installed expo package version:
react-native-reanimated - expected version range: ~1.9.0 - actual version installed: ^1.10.1
Your project may not work correctly until you install the correct versions of the packages. To install the correct versions of these packages, please run: expo install [package-name ...]`
Thus, I run the code as follow: npm install react-native-reanimated#1.9.0, but still run into the error code.
I could realy use some help on this.

try uninstalling the package ==> close ide (all instances) ==> open the ide ==> install the package again ==> run "expo start -c"

Only do this:
expo start --clear
From Expo Documentation at Expo Start command.
--clear, -c | Clear the React Native Packager cache.

Related

Typescript version in VScode

I have a CRA app in VSCode.
My global TS version is:
My project TS version is (package.json):
VSCode uses the latest:
Now, when I try to add a 4.0 TS feature, the terminal shows a compilation error:
I tried to change the package.json TS version to latest and ran npm install but it didn't help.
My Questions are:
Why doesn't it compile?
Which TS version is used for PROBLEMS pane and which for terminal? I would expect the same error in both locations.
Thanks in advance!
When you run tsc -v in the terminal, you are calling a globally installed Typescript package which is showing you have version 4.8.4 installed.
You can verify this by running npm list -g --depth 0 which will list all the global packages you have installed, along with their versions.
However, when using npm scripts (e.g in CRA npm run build) the Typescript package inside your node_modules folder is called. Since this version of Typescript is 3.x the compilation will fail. By changing VSCode to use the workspace version, the same error will be shown.
Upgrading the version inside your package.json to the latest should fix this error. To be sure the correct version is being used, try using an npm script to list the version by including this vers script in your package.json
"scripts": {
"...": "your other scripts",
"vers": "tsc -v"
}
then run npm run vers in your terminal.
TLDR:
Q1.
The Typescript version used when running the CRA build script (3.x)
is targeted which will fail when using 4.x syntax.
Q2.
The problems pane in VSCode uses the VSCode Typescript version
(depends how up to date your VSCode is) unless manually switched to
use the workspace version (node_modules version).
The terminal will target your globally installed version.
NPM scripts will target the version inside your node_modules folder.

React Storybook throws error when using npx sb init

I am trying to install Storybook on my project. All I do is initialize the create-react-app and then cd to the current directory. When I enter 'npx sb init' I am getting the following errors:
• Detecting project type. ✓
• Adding Storybook support to your "Create React App" based project
Unable to find versions of #storybook/react using npm
Unable to find versions of #storybook/addon-links using npm
Unable to find versions of #storybook/addon-essentials using npm
Unable to find versions of #storybook/addon-actions using npm
Unable to find versions of #storybook/node-logger using npm
Unable to find versions of #storybook/preset-create-react-app using npm
System
Node: v16.13.0
NPM: 8.1.4
Ubuntu 21.10
Notes
I was able to find a relatable problem here, but unfortunately it doesn't seem logical to init the project on a VM and then copy it locally..
I'm using Ubuntu 20.04.
I had the same issue. The problem was that I had installed node through snap. https://github.com/nodesource/distributions/blob/master/README.md - here is the example how to install on Debian / Ubuntu without using snap.

How do I fix my "No valid exports main found" compile error?

I tried to compile the files using
npm start
but it doesn't works.
In my chrome and terminal, it says like this way.
Failed to compile
./src/index.css (./node_modules/css-loader/dist/cjs.js??ref--6-oneOf-3-1!./node_modules/postcss-loader/src??postcss!./src/index.css)
Error: No valid exports main found for 'C:\Users\Jiwoo\Desktop\movie_app_2020\node_modules\colorette'
I tried to delete folder [node_modules] and typing "npm i" but it doesn't works too.
How can I fix my error?
upgrade node.js and also remove create-react-app globally by using below command
npm uninstall -g create-react-app
and using:
npx create-react-app myapp
I am using Windows 7 and the latest working Node version is 13.6. Therefore to make it run the only option is to downgrade autoprefixer: npm i autoprefixer#9.8.0
Downgrading colorette module to 1.2.0 didn't help.
The ultimate solution is to upgrade Node, however, it's not possible on Windows 7. Alternatively, one can try to compile it on a VM or with a docker image that supports Node 14+.
For windowss 7 user who are using any of the 12+ version just download the last 13 version which is v13.14.0. Before installing this version make sure to uninstall the previous version installed.
Here's the download link
Download the .msi file instead of exe file
Hope it will work
Thanks

How do i downgrade expo and install a specific package?

Some of your project's dependencies are not compatible with currently installed expo package version:
- #react-native-community/netinfo - expected version range: 5.5.1 - actual version installed: ^5.8.0
Your project may not work correctly until you install the correct versions of the packages.
To install the correct versions of these packages, please run: expo install [package-name ...]
Im getting this above warning. is there any cli command to do install specific expo package? if yes then please provide it. Thanks.
Into your package.json file, update the version of #react-native-community/netinfo to the right one (5.5.1), and make a npm install again.
You can also provide the version by using the cli command :
npm i #react-native-community/netinfo#5.5.1

Could not find iPhone X simulator

I am unable to run react-native project on iPhone.
I am using
Xcode version: 11.0
react-native: 0.61.1
react-native-cli: 2.0.1
whenever I run react-native run-ios it always throw and error saying
info Found Xcode project "AwesomeProject.xcodeproj" error Could not
find "iPhone X" simulator. Run CLI with --verbose flag for more
details.
You may need to install the new react native cli tools npm i #react-native-community/cli-platform-ios --save or use this solution, the same applies for cli-platform-android, if the package is already installed for you, this solution may work for you

Resources