查看网络中其他设备上的NodeJS项目 [英] Viewing NodeJS projects on other devices in the network

查看:42
本文介绍了查看网络中其他设备上的NodeJS项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从其他设备查看CreateReactApp项目.我尝试通过将开始"脚本设置为

I’m trying to view a CreateReactApp project from a different device. I tried setting the host to 0.0.0.0 by setting the "start" script to:

"start": "cross-env HOST=0.0.0.0 react-scripts start".

尽管控制台确实记录了

Attempting to bind to HOST environment variable: 0.0.0.0
If this was unintentional, check that you haven't mistakenly set it in your 
shell.
Learn more here: [URL BLOCKED BY GITHUB].

我无法使用计算机的IP从同一网络上的其他设备访问此项目.

I could not access this project from another device on the same network using the computer’s IP.

同时,我设法使用计算机的IP从同一设备访问同一计算机上的其他项目(从"tomcat"本地服务器).知道为什么会这样吗?我的环境:Windows10.我在一个以上的Create-React-App项目中都在"PowerShell"和在Windows上的Ubuntu(Bash on Windows(WSL))"上进行了尝试.

At the same time I managed to access other projects (from a "tomcat" local server) on the same computer from the same device using the computer's IP. Any idea why this might be happening? My environment: Windows10. I tried it on both ‘PowerShell’, and ‘Bash on Ubuntu on Windows (WSL)’, on more than one Create-React-App project.

推荐答案

Windows Defender防火墙阻止了该连接.它具有"NodeJs:服务器端JavaScript"的阻止规则.打开连接:

Windows Defender Firewall was blocking the connection. It had a blocking rule for "NodeJs: Server Side JavaScript". To open the connection:

设置=>更新和安全=> Windows安全=>防火墙和网络保护=>高级设置=>入站规则=>删除阻止节点服务器的规则.

Settings => Update and Security => Windows Security => Firewall and network protection => Advanced Settings => Inbound rules => remove rules blocking node server.

Windows阻止时未显示通知.出于某种原因,可能是出于某些原因,我编写了它来阻止与nodeJS服务器的连接.

Windows did not show a notification when blocking. It might be that at some point for some reason I authored it to block a connection to the nodeJS server.

这篇关于查看网络中其他设备上的NodeJS项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆