How to fix this error while installing a module with expo - react-native

I'm trying to install a module (DateTimePicker for Expo).
Accordingly to documentation we have to use the following command:
expo install #react-native-community/datetimepicker
However, when executing that command, this error appears

This is not related to expo, is because you are using the new npm dependencies.
So you only need to follow the error message
expo install #react-native-community/datetimepicker --legacy-peer-deps

Related

How to solve this error, Uncaught Error: 36.0.0 is not a valid SDK version. Options are 35.0.0, 34.0.0, 33.0.0, UNVERSIONED

I am working on React native new project when I enter npm start I got this error on my Mobile with blue screen Uncaught Error: 36.0.0 is not a valid SDK version. Options are 35.0.0, 34.0.0, 33.0.0, UNVERSIONED. I tried to solve this error by using these commands
npm install (for node module)
expo update
npm install react-native-gesture-handler --save
npm start
But It didn't work, please help me to resolve this issue.
As said here, you can try to delete the expo client on the emulator, and run the project again. This should work.
Here's the documentation of how to upgrade your expo version, but i think you don't will need it, because you're on the latest version.

How to fix error in "Copying template" when making project?

I'm generating a new project using React-Native in Command Prompt but I get an error when I use the following command:
react-native init Style
This is the result I get:
√ Downloading template
× Copying template
error Error: Cannot find module 'C:\Users\User\AppData\Local\Temp\rncli-init-template-srEvW0\node_modules\react-native\template.config'
error EBUSY: resource busy or locked, rmdir 'D:\FUSI\React Native\Style'. Run CLI with --verbose flag for more details.
Error: EBUSY: resource busy or locked, rmdir 'D:\FUSI\React Native\Style'
at Object.rmdirSync (fs.js:684:3)
at rmdirSync (D:\FUSI\React Native\node_modules\fs-extra\lib\remove\rimraf.js:276:13)
at Object.rimrafSync [as removeSync] (D:\FUSI\React Native\node_modules\fs-extra\lib\remove\rimraf.js:252:7)
at Object.initialize [as func] (D:\FUSI\React Native\node_modules\react-native\node_modules#react-native-community\cli\build\commands\init\init.js:295:26)
at process._tickCallback (internal/process/next_tick.js:68:7)
How can I fix this error?
Mustafa AK had it right. What worked for me is adding the --npm flag at the end of the command.
I followed the tutorial exactly how it was laid out on the React website and was running into the same error. For whatever reason, if you have yarn and npm installed the command to create a new project will not work. So you have to add the --npm flag to get it to only use npm and this will work.
npx react-native init AwesomeProject --npm
This Same error comes with me. But I solved by following ways...
First, uninstall the node from your system and download the latest version of node and install it.
2.after installation of the latest version of node you need to write the command in your command prompt
npm install -g react-native-cli
Now go to your project directory
cd your-react-native-project directory
now create your react-native project
react-native init your-project-name.
https://stackoverflow.com/a/71725307/16114216
Be sure uninstall global react-native/cli as described react-native tutorials
Try to use --npm end of init command if you had yarn and npm both.
npx react-native init MyApp --template react-native-template-typescript --npm
Note: If you have both yarn and npm installed on your machine, React Native CLI will always try to use yarn, so even if you use npx utility, only react-native executable will be installed using npm and the rest of the work will be delegated to yarn. You can force usage of npm adding --npm flag to the command.

why do I get react-native command not found error on windows pc?

I am very new to React-native and I have a sample project when I tried running the command react-native run-android. I got an error command not found.
in the current directory do
react-native -v
you will get the following
react-native -v
react-native-cli: version
react-native: version
if it shows command not found the n you have not installed react native in the directory. Do a npm init in new folder and try installing a new react native project there
by doing npm install -g react-native-cli
Follow the steps to add path variable react-native.
You're good to go.
Have you run 'npm install' (without parameters) in the project directory? That'll install the dependencies for your project.
Details here: https://docs.npmjs.com/cli/v6/commands/npm-install
1.Try to install globally npm install -g react-native-cli 2.add path of npm module (C:\Users\your user name\AppData\Roaming\npm) to system variables instead of user variables

Error encountered after I execute react-native install

C:\ProjectName> react-native install
Scanning folders for symlinks in C:\ProjectName\node_modules (794ms)
error: missing required argument `packageName'
I ran the command above and recieve the error shortly afterwards. I am not very sure what the problem is I am new to react-native and was just trying to ran an already developed project. I hope someone can help shed some light regarding this.
You are missing the package manager.
If you are using yarn:
yarn add react-native
or npm:
npm install react-native
You can read more here:
https://blog.risingstack.com/yarn-vs-npm-node-js-package-managers/
EDIT: Also, don't forget to install react-native-cli

React Native - Can not create new project via react-native-cli when react-native version is > 0.55

I am trying to create new project via react native project via react-native-cli react-native init ProjectName and get the following error
error Found incompatible module info
Visit https://yarnpkg.com/en/docs/cli/add for documentation about this
Error: Command failed: yarn add react-native --exact
Project can be created with the same command when react native version is less then or equal to 0.54
react-native init ProjectName --version react-native#0.54
The following links also did not helped me.
https://github.com/facebook/react-native/issues/14861
https://github.com/yarnpkg/yarn/issues/3227
I solve the problem just moment.
the reason is node version problem.
you can install >10.0 node.
then, react-native init project succeed.
I came across similar issue. Following are the steps I took to solve it.
Noticed the yarn error occurs due to incompatible node module version. It required node version >= 8.0. For this, I changed the node version using nvm:
nvm use 8.0.0
Note: Check first if you have a installed node version >= 8.0 using nvm list. If yes, just use the above command. Otherwise install it by nvm install v8.0.0.
After this, you might come across similar error for npm. I did not have updated npm version. Install latest npm by npm install -g npm#latest
Try to create new react-native project, react-native init HelloWorld.