npm start command open specific page at running - npm

I m developping a reactjs app.
So to start the server I run :
react-scripts start
However this opens http://localhost:3000 in my browser.
Is there a manner to change the url to http://localhost:3000/login ?

Try something like this:
PUBLIC_URL=\"http://localhost:3000/login\" react-scripts start

Related

Metro bundler link 19000 shows json dump on react native expo instead of bundler web page with qr code

I usually run expo start or expo start -c and a browser will auto open at localhost:19000 with the metro bundler details that displays the qr code, connection: tunnel, lan, local, and of course the exp: address of the app.
Suddenly, when I run expo start, the browser no longer open. and when I navigate to localhost:19000, it shows a json dump:
{"name":"litplans","slug":"litplans","version":"1.0.0","orientation":"portrait","icon":"./assets/icon.png","userInterfaceStyle":"light","splash":{"image":"./assets/splash.png","resizeMode":"contain","backgroundColor":"#ffffff","imageUrl":"http://127.0.0.1:19000/assets/./assets/splash.png"},"updates":{"fallbackToCacheTimeout":0},"assetBundlePatterns":["**/*"],"ios":{"supportsTablet":true,"bundleIdentifier":"com.mallsecinc.litplans"},"android":{"adaptiveIcon":{"foregroundImage":"./assets/adaptive-icon.png","backgroundColor":"#FFFFFF","foregroundImageUrl":"http://127.0.0.1:19000/assets/./assets/adaptive-icon.png"}},"web":{"favicon":"./assets/favicon.png"},"_internal":{"isDebug":false,"projectRoot":"C:\\sites\\apps\\litplans","dynamicConfigPath":null,"staticConfigPath":"C:\\sites\\apps\\litplans\\app.json","packageJsonPath":"C:\\sites\\apps\\litplans\\package.json"},"sdkVersion":"45.0.0","platforms":["ios","android","web"],"developer":{"tool":"expo-cli","projectRoot":"C:\\sites\\apps\\litplans"},"packagerOpts":{"scheme":null,"hostType":"lan","lanType":"ip","devClient":false,"dev":true,"minify":false,"urlRandomness":"2x-kif","https":false},"mainModuleName":"node_modules\\expo\\AppEntry","__flipperHack":"React Native packager is running","debuggerHost":"127.0.0.1:19000","logUrl":"http://127.0.0.1:19000/logs","hostUri":"127.0.0.1:19000","bundleUrl":"http://127.0.0.1:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=ios&dev=true&hot=false&strict=false&minify=false","iconUrl":"http://127.0.0.1:19000/assets/./assets/icon.png"}
The only thing that I did different is uninstall and installing node.js.
To trouble shoot, I've done the following:
Try to run an exisitng expo project.
List item
start a brand new expo project.
remove node_modules and install again
remove expo module and install again
Metro Bundler UI is no longer available after expo-cli#6.0.0
https://blog.expo.dev/sunsetting-the-web-ui-for-expo-cli-ab12936d2206
For me using "start": "expo start" instead of "start": "expo start --dev-client" worked maybe if you share what your dependencies look like it would be helpful

Cypress: When I try to run npx cypress open the window opens and then closes immediately

I'm trying to learn cypress, but I haven't been able to get past installation. I follow the documentation, I run npm init and then npm install cypress --save-dev.
Next I tried running npx cypress open and adding to the package.json "cypress:open" : "cypress open and then running npm run cypress:open. In both cases, the launchpad opens for a few seconds and then closes immediately. I understand that it should create a cypress folder in my directory but it doesn't do anything, just closes. There is no error message or anything similar.
I don't know what to do and I can't find any information regarding this error, please help
Console when running commands
I solve it by downgrading Cypress to version 10.0.3

How to run a development server in Laravel Mix (standalone project)

I'm trying to run a server to see my project on browser, the only way i can do it is running npx mix watch --hot, so after that my project start running at localhost:8080.
But the above command enable hot reload, i would like to know if there is some specific command to just run the server, without enabling hot reloading.
I tried npm mix watch but it not starts the server, just watch the files.
Tried calling manually webpack server with:
./node_modules/.bin/webpack serve --config="./node_modules/laravel-mix/setup/webpack.config.js"
This works (the server starts at localhost:8080 as well) but somehow it activates hot reloading too, idk why.
So, there is some way to just start the server? Without enabling hot reloading?
Here is my webpack.mix.js file:
let mix = require('laravel-mix');
mix.sass('src/scss/app.scss', 'dist/css/')
.js('src/js/app.js', 'dist/js/').react()
.setPublicPath('public');
My package.json has just the default script:
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
If you're using Composer you can run php artisan serve, this will start a local php server and serve your web pages to the browser Laravel installation.

Task :app:processDebugResources FAILED - REACT-NATIVE - ANDROID-STUDIO

im trying to run the app in my real device using android studio, eveything is ready and correct, but when i run react-native run-android it will first says connect to the server but then this error appears:
want to use the device as debugger
For running expo apps, you would normally do this using the command line.
Navigate to the root of your project, then (if you still have all the defaults set) you should be able to open a terminal in that directory and type npm run start. This will start the metro bundler and the other react native tools.
The first time doing this might take a while, but when it's done, you should see a QR code. Scan it with your device, you should be prompted to download the expo app and then your application will run on your phone. You only need to download the expo app once, and all the apps you develop using expo will run on it.
I'm not totally sure if this answers your question, but I hope this helped.
*note that this assumes that you have and use npm, the process is slightly different for yarn and other package managers. If npm run start doesn't work for you, make sure you have npm in the PATH variable, and check the package.json file. You should see an entry in scripts - "start": "expo start". You need to type npm run then whatever your key is for the script that has a value of "expo start"

Red Error Screen when build first project in React

Today I start to learn about React. After install React by some command in Terminal, I use react-native MyFirstProject to create my first project, and in my Android Studio emulator get a red error screen like this:
Error Screen
I tried to resolve follow there command but still have no idea what I am doing? Can someone explain for me how to fix it? Thank you.
To fix open a new terminal,go to your project folder and run
npm install
after installation complete
npm start
What “npm start” does is start your react package manager, read more about it in details here
https://github.com/rnpm/rnpm
Also run the command,
This is quite a useful tool during development.
adb reverse tcp:8081 tcp:8081
And last Reload.
For android one can use CTRL + R For apple one can use R + R (two
times R).
Looks you didn't install babel, babel module is not existion the the node_module.
npm install babel then npm start
If it doesn't work. You can try npm start --reset-cache
Hope it help.