0

I am developing on my laptop, using npm, and would like to check the site I am working on from a mobile device (on the same network). Can I set NPM to allow external access from the LAN?

I've tried browsing to ip.of.my.laptop:3000

Even with UFW disabled it doesn't load

EDIT: With ufw disabled and http-server running, the site loads but only as a list of files.

AndyCasq
  • 1
  • 2
  • 1
    This might be what you're looking for: https://stackoverflow.com/questions/30712141/connect-to-localhost3000-from-another-computer-expressjs-nodejs – jared Oct 30 '19 at 20:32
  • Thanks Jared. I can't make the leap from implementing a fix for expressjs to npm. I understand what I need to do - have npm allow connections from other hosts - I don't know what code goes where to do that. – AndyCasq Oct 30 '19 at 20:50
  • It might be just a firewall on your machine? What is the OS? – Ralph Oct 30 '19 at 21:09
  • Thanks Ralph but I found the answer on https://github.com/angular/angular-cli/issues/3765 from user Sumeetkaushiik – AndyCasq Oct 30 '19 at 21:11

1 Answers1

0

Worked it out:

I am on Ubuntu. Firstly, disable ufw

sudo ufw disable

Then, when starting npm, specify the host IP by:

HOST=0.0.0.0 npm run dev
AndyCasq
  • 1
  • 2