Giter Site home page Giter Site logo

dev-ip's Introduction

dev-ip Build Status

Find a suitable IP host to view local websites on.

Command line

Install it globally to use on the command line (use sudo only if necessary):

npm install -g dev-ip

then run:

dev-ip

"http://192.168.1.46"

In your project

npm install dev-ip

var devip = require('dev-ip');
devip(); // [ "192.168.1.76", "192.168.1.80" ] or false if nothing found (ie, offline user)

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Run lint & tests with gulp.

Release History

(Nothing yet)

License

Copyright (c) 2013 Shane Osbourne Licensed under the MIT license.

dev-ip's People

Contributors

alexswensen avatar nddery avatar shakyshane avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

dev-ip's Issues

node v18.0.0 not returning local IP

Bonjour!

I use browser-sync, which uses this code as a dependency. I recently updated to node 18.0.0 without second thought and started getting the following error, where there was no external IP returned. The output looked like this:

[Browsersync] Access URLs:
 ----------------------------------
       Local: http://localhost:3000
    External: http://false:3000
 ----------------------------------
          UI: http://localhost:3001
 UI External: http://localhost:3001
 ----------------------------------

So I downloaded dev-ip, did some digging and it seems like for some reason address.family isn't returned as a string of IPv4 anymore, like in the original code, but as an integer 4.

Logging the addresses looks like this, without the unimportant bits:

{
  address: '—',
  netmask: '—,
  family: 4,
  mac: '—',
  internal: false,
  cidr: '—'
}

Any chance you could take a look? I've reverted back to node v17 in the meantime, but I feel like this problem might pop up for others as well.

I'm sorry if this isn't the most comprehensive ticket, I don't usually engage much with anything on github.

Cheers
Felix

Return inside if block

I use browser-sync which use your code as a dependency. When I transpile my code with babel6 a get this error:
browser-sync/node_modules/dev-ip/lib/dev-ip.js: 'return' outside of function (41:8)

   39 |     var out = getIp();
   40 |     if (!out.length) {
 > 41 |         return console.log(messages.error);
      |         ^
   42 |     }
   43 |     console.log(getIp("cli"));
   44 | }

If I remove return from the 41th line, everything is ok.
Could you verify my statement or fix this issue. Thans a lot.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.