starting react native app - node.js

I'm starting work on React Native, using create-reactive-native-app and Exponent. There is a nice list of open source examples here, some of then are mentioned to use Exponent.
https://github.com/ReactNativeNews/React-Native-Apps
I have few experience with nodejs. I already noticed there are several possible configurations for React Native apps. I usually use npm start to run it, but that don't work on those examples, since since they don't have a start script in package.json.
Take as an example the native-component-list app. How can I execute it after cloning and doing npm install?
Using node v6.11.4 and npm 3.10.10
I also tried using react-native run-android . It works when I create a new project with react-native init Ola2
But not with the downloaded code.
Here are some more details. I did this before: npm install -g react-native-cli
npm install
react-native run-android
Scanning folders for symlinks in xxx/native-component-list/node_modules (25ms)
Android project not found. Maybe run react-native android first?
react-native android
Scanning folders for symlinks in xxx/native-component-list/node_modules (26ms)
Unrecognized command 'android'
Run react-native --help to see list of all available commands

As per this link, you can run the app with command react-native run-android (for android)

I found the problem. I just had never used Expo.io way to create a ReactNative app. I only knew the init and the crna ways. This apps where created with the exp tool.
So,to run it, just do:
npm install exp --global
npm install
exp android
exp start

I didn't work on Expo, I prefer react-native-cli
In your case, your project in developed on Expo.
So you need expo-cli to run the project.
For Expo Cli
npm install -g expo-cli
For CRNA
npm i -g create-react-native-app
Internally CRNA use EXPO, so you can choose any option. After installing the expo-cli npm start command work fine for you.
Or you can eject this project.
You can run npm run eject to get a project very similar to what react-native init would generate. At that point you’ll need Xcode and/or Android Studio just as you would if you started with react-native init , adding libraries with react-native link will work, and you’ll have full control over the native code compilation process.
Hope it will work for you.

Related

Using firebase cli when not installed globally

I'm using my work computer while developing a sort of side project. Nothing crazy just learning some new firebase stuff. Anyways, because it is a work computer I can't install modules globally. So when it came to installing firebase-cli I tried using the recommended global command:
npm install -g firebase-tools
That didn't work because I don't have permission due to this being a work computer. So I created a firebase folder just for this project and ran
npm install firebase-tools
In the new folder. Once finished I tried running
firebase -version
But this resulted in
firebase: command not found
I thought this would work since I'm in the directory I created and installed firebase in but it doesn't work. Any help please!
If you want to run any command from a package that was installed in a project, use npm exec from the project folder.
npm exec -- firebase [CLI args]
The version command you were trying to run would go like this (note it's two dashes for the flag)
npm exec -- firebase --version

Why npx create-react-app is showing "the project was bootstrapped with an old unsupported version of tools"?

I recently switched to Ubuntu, whenever I create react app it's giving me this note, and the app it's creating is a class component.
ankit#gram:~/Documents/Development/React/react-project$ npx create-react-app my-app
Creating a new React app in /home/ankit/Documents/Development/React/react-project/my-app.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
added 987 packages in 39s
22 packages are looking for funding
run `npm fund` for details
Success! Created my-app at /home/ankit/Documents/Development/React/react-project/my-app
Inside that directory, you can run several commands:
npm start
Starts the development server.
npm run build
Bundles the app into static files for production.
npm test
Starts the test runner.
npm run eject
Removes this tool and copies build dependencies, configuration files
and scripts into the app directory. If you do this, you can’t go back!
We suggest that you begin by typing:
cd my-app
npm start
Happy hacking!
Note: the project was bootstrapped with an old unsupported version of tools.
Please update to Node >=14 and npm >=6 to get supported tools in new projects.
my node version: v16.14.0
my npm version:8.3.1
I think this was because npx was not installed in my system, when I created a react app by this command create-react-app the app created was fine. I also installed npx using this command npm install -g npx and created a react app and everything was fine. before this make sure you have installed create-react-app in your system if not then install it by using this command
sudo npm install -g create-react-app
I am a new programmer had this issue not long ago I just solved it.
Use sudo apt install nodejs
It will automatically install version 10 for you which doesn't accept React.
Then you try to install NVM package, use it to update your node to a newer version.
You can check me on GitHub bari racha Wuye
I was having the same problem after I had just installed Ubuntu 22.04.
The fix for me was updating node and npm by following these instructions free code camp update node and npm
Specifically, I followed the instructions under the heading "1. Use NPM to Update Your Node Version", to update node and ignored the 2nd and 3rd headings, then followed the instructions under the last heading to update npm
afterwards I restarted my computer, opened the project directory and ran the command
npm i create-react-app#latest
then I ran
npx create-react-app projectname
and it worked as expected

React Native error : 'react-native' is not recognized as an internal or external command, operable program or batch file

I have been using React-Native for a project it's been more than a month, to create the app I uninstalled the react-native-cli and followed what is described in the official docs (https://reactnative.dev/docs/environment-setup). Yesterday, I modified an existing project (from github) and run :
npm install
npx react-native run-android
I had some errors so I updated npm, everything worked fine. I restarted my computer and tried to create a new app using the following command:
npx react-native init Test
This is the error that I get:
I uninstalled Node and installed the newest version (16.0.0) with npm version (7.11.2) and npx version (7.11.2).
Can someone please help me with this?
Uninstalling global packages
use this commond
npm uninstall -g react-native-cli
then restart computer and try create new app
I restarted my computer and tried to create a new app using the following command: npx react-native run-android Test
to create new app in react native use init not run-android
npx react-native init Test
i think you need to install react native cli but first Add npm path to your Environment variables; both system and user then install npm and react-native cli.
and if that does not work,Solution is to install react-native-cli globally You can install it globally by using the below command:
npm install -g react-native-cli

Create-react-app not working - packages looking for funding

I installed node, then I ran npm install create-react-app, then ran npx create-react-app hello-world.
The last command did not go through because of some package funding, whatever that means.
How do I fix this?
I am using windows. Here is how my command prompt looks like:
When you do "npm install create-react-app" you're installing in the current folder a CLI to ease up creating a React template for your projects. Doing "npx create-react-app hello-world" is redundant as you've already downloaded the create-react-app module, if you do not wish to save the CLI software and only create the template then it's a better approach.
Using the "-g" flag will allow you to use the CLI globally to create React projects on your computer ("npm install -g create-react-app" this might require certain permissions) instead of only the specific folder you're on.
Once you're done you must use the command "create-react-app 'your_project_name'" to use create-react-app to create your project. More information here https://reactjs.org/docs/create-a-new-react-app.html#create-react-app, to start the project just head inside the created folder and do "npm start".
Packages looking for funding is exactly what it says, the developers of these modules are looking for funding.
Uninstalling x64 version of node and install x34 version solved my same issue.

React-native removed when use npm install

I don't understand why my npm make that and i'm new with react-native.
Here is the description of my "bug" on Windows 10 :
I can use react-native command for run android or create react-native app like that react-native init TestApp
When i go into my app folder with cd TestApp and i run react-native link or other react-native command everythings work fine.
But if i install a new package like fbsdk with npm like that npm install react-native-fbsdk --save i saw after installation this message :
added 1 package and removed 639 packages in 22.207s
And after that, if i would like use react-native command i have this message :
Command link unrecognized. Make sure that you have run npm install and that you are inside a react-native project.
For this message, i have entered react-native link command.
You know why npm remove all my packages ?
I got the same problem.
However I solved the problem by deleting the package-lock.json and then running npm install.
Check the answer here.
I also noticed recently that npm install doesn't do what I expect, but that may be because I'm newbie.
However yarn install is a good replacement and is working fine for me. I used it to upgrade/downgrade things by directly editing packages.json, and it also solved the npm link problem that I faced.
Edit: downgrading to npm 7 solved all my issues

Resources