[Feature Request] View the app "On Your Network" #62351
Replies: 24 comments
-
and you should be able to use it to access the next.js app that's running on your laptop from anywhere else on your LAN. |
Beta Was this translation helpful? Give feedback.
-
I understand it can be done manually but it's a user experience thing. I usually open the links by simply clicking on them while in the terminal, Having it right there makes it so I don't have to go though the extra steps. |
Beta Was this translation helpful? Give feedback.
-
Bump for visibility, It's not that much effort to do the lookup, but it's way easier when debugging on several mobile devices. |
Beta Was this translation helpful? Give feedback.
-
It's marked as good first issue, feel free to implement @roberrrt-s. |
Beta Was this translation helpful? Give feedback.
-
Will try so somewhere in the next days, cheers! |
Beta Was this translation helpful? Give feedback.
-
Hey, saw the conversation happening here and was reminded of this issue so I decided to try to solve it myself. I've opened a pull request - #22352 |
Beta Was this translation helpful? Give feedback.
-
@Janpot are there any other steps to get this working? I tried simply adding the port to the end of local address and got a timeout. |
Beta Was this translation helpful? Give feedback.
-
what worked for me:-
00-npm run dev |
Beta Was this translation helpful? Give feedback.
-
If you're on a Mac, make sure to:
Abdullah's answer above does work for me. |
Beta Was this translation helpful? Give feedback.
-
Any idea why I might be getting
When I'm trying to test on my iphone? It works locally. |
Beta Was this translation helpful? Give feedback.
-
This would be a great add, a quick win that decreases the need for me to come back here each time a need to use nextjs on mobile. |
Beta Was this translation helpful? Give feedback.
-
Workaround$ npm i address --save-dev And add the following code to your if (process.env.NODE_ENV === 'development') {
console.log('info - lanUrl:', `http://${require('address').ip()}:3000`)
} |
Beta Was this translation helpful? Give feedback.
-
If I wanted to tackle this issue, I'd need to basically re-implement all of this package anyways to find the correct IP address in a cross-platform and safe way. This is marked as good first issue, but I'm assuming the Next.js team would be opposed to installing |
Beta Was this translation helpful? Give feedback.
-
No need, my pull request #22352 implements a getNetworkHost function that handles this. To get the correct behavior, I studied the source code of address and vite. My implementation in particular was based on vite's server code. |
Beta Was this translation helpful? Give feedback.
-
Ah! Sweet. Thanks for stopping me. Great work! |
Beta Was this translation helpful? Give feedback.
-
is am not able to use this on my phone (other LAN devices) any suggestions,
http://192.168.0.105:3000/ is working on a laptop where the next.js server is not on other LAN devices. |
Beta Was this translation helpful? Give feedback.
-
Same for me, and tried exactly the same steps as @theabhayprajapati |
Beta Was this translation helpful? Give feedback.
This comment has been minimized.
This comment has been minimized.
-
I found my local network ip4 address and opened my next.js webpage on my laptop, but I was unable to open on my mobile which is connected to the same local network; any solution to open on my mobile with live changes |
Beta Was this translation helpful? Give feedback.
-
This will work on nextjs |
Beta Was this translation helpful? Give feedback.
-
Here is my solution In WSL
On the Windows host
Put all together on the Windows host (must be admin)
Now you can type |
Beta Was this translation helpful? Give feedback.
-
Hey guys. I was able to access my next.js app through my android phone by setting my wi-fi network profile to 'private' in windows config. And then accessing "192.168.1.3:3000". I was not able to do it while the network profile was public. In windows go to: Settings > Network and internet > Wi-fi > Manage know networks > [choose your wi-fi network] > [change the network profile to 'private']. |
Beta Was this translation helpful? Give feedback.
-
Hi.. I hope this case can still be discussed.. when I press the login button, I am again redirected to How do we make Next JS always point to the IP that we have specified? I'm using NextAuth, here is the simple code for my simple application: |
Beta Was this translation helpful? Give feedback.
-
Hi everyone! Since this is a feature request, I will be moving this to our No to worry—the number of reactions, comments etc. will stay so this feature request will still be top of mind! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
View the app "On Your Network"
By default create-react-app make the app live on
localhost
as well as your network.This would make it easier to test on mobile devices. Also the current way has the text mixing in with all the other details and becomes harder to find. I would be better to highlight somehow, maybe draw a box around it.
Edit: I opened a PR to solve this #22352
Beta Was this translation helpful? Give feedback.
All reactions