I see no output of React Native packager on Linux (Ubuntu 17.04) and react-native 0.51.0 even though it is running.
A teammate uses Windows 10 and after react-native run-android he gets a new window with output from the packager.
Is there a way to see the packager's output ?
Before running react-native run-android try running react-native start in a different terminal, this command will start the packager manually.
PS: react-native run-android is optional if you didn't change one of native android files, you can just start the packager and then reload the already installed app.
Related
I just started studying front-end development and I'm struggling with a node.js error.
Typing 'npm start' in my VSCode terminal used to work fine for simple tutorial projects with just an index.html, script.js, and style.css file. (without a package.json file)
However after trying out React for the first time, 'npm start' now doesn't work anymore in my other non-React projects. At first it was giving me an error that it was missing the package.json (which it didn't need before?) but after trying to fix it with help of googling I now got to a point where it's giving me the error: Missing script: "start".
How can I run node without creating package.json files for every small tutorial project I've made previously, or without turning them into React apps? Also why is this happening? Did installing React-native create dependencies of some sort?
Thanks in advance!
I already tried reinstalling node.js and tried different versions. Also tried deleting package-lock.json. It still works for React apps, just not with simpler native javascript apps.
A package.json file is required if you want to install any packages or run scripts in your terminal. In your package.json file, make sure you have added scripts property. This is an example of how you can use it:
{
...
"scripts": {
"start": "react-scripts start"
}
}
Remove ... from the snippet if you're copying, this has been added to indicate that there are one or more fields in this JSON file.
After you have added this to your package file, you will be able to run the start script by typing npm run start in the terminal or if you use Yarn: yarn start.
Edit:
You said that running npm start in your React project is running fine, but on your simpler projects with only a simple HTML, CSS and JS file is not working when using the script.
You are probably confusing npm start with node file.js. Where node file.js doesn't require a package to be in your project to run a JavaScript file, using npm start requires you to have a JSON file present in your project folder with the JSON code as in my answer.
So long story short: Using npm start requires package.json with the script property available. While node file.js doesn't require you to have this file in your project.
if you are using react-native you can do the following
First you have to build your project with the command
npx react-native run-android , npx react-native run-ios
Once your project has build successfully and app is installed on your device then you your development server is started already. for some reason if your server is closed then you can run it with the command given below.
adb reverse tcp:8081 tcp:8081 this will send a signal to your device and after this run npx react-native start
I've been trying to run this code that brings up an electron GUI and takes input from the user. I I've used the following commands to run this project in VSCode powershell terminal:
npm install
npm start
I get the following error messages in the terminal afterwards:
Error Message 1
Error Message 2
Error Message 3
I've already checked that I have the most updated packages for nodejs, npm, electron, electron-packager and electron-builder. You can see the last three in my package.json file under the devDependencies.
Package.json dev dependencies and scripts
I don't really understand what the error is saying here. From the googling I've done, it seems like this happens on WSL when you're trying to launch an electron application but I'm working off of my local machine on Windows, so I wouldn't think that a GUI should throw an error.
I can run main.js by using electron.cmd main.js but this just brings up the GUI splash from electron but the code itself doesn't seem to be executing.
The answer in my case was switching to use Yarn instead of npm. Clearing the node modules folder and running yarn install and running election ./app from the main project folder.
I just installed node.js on my centos 7 server, then install react
it successfully created my new react app, after that, I run:
npm start
and or serve -s build
but none of these run in my browser.
This site can’t be reached
how can I solve this?
If you have sever inside can you try with start debugging of your application
Stop npm, if you're using yarn
Start the project with command above, inside your project home folder
yarn start
Take some time to learn commands below:
i'm new to react native and i was trying to build an app to see how it works,i followed the steps given here
Getting Started with React Native
till npm start,everything seems to be fine,after i type npm start,it says
12:08:53 PM: Starting packager...
and gets stuck at that,am i doing something wrong,I'm on Ubuntu 16.04
any inputs would be helpful
It was fixed by runnig
sudo sysctl -w fs.inotify.max_user_watches=10000
See this site:
https://forums.expo.io/t/packager-not-loading-on-linux/2034/3
everyone has a different solution, depending on the problem.I have a few step that work for me.I just run this command on console:
react-native start --reset-cache
wait until console display like image below:
after that press Ctrl + C and run npm start or yarn start or other command to run your react-native project.
Just getting started with Ionic 2. When i have the app running in NodeJS, I cannot seem to add commands such as "ionic g providers myapi" - I assume these can only be entered when ionic serve is not running?
Also previously using Ionic1 I could stop ionic serve using quit in the CLI, but there seems to be no way of typing anything when ionic serve is running in the NodeJS console. So I have to currently do a hard close andd re-start the NodeJS application (I am running on Windows 8)