简体   繁体   中英

How to setup node-inspector with vagrant?

I have an meanjs application running on a vagrant box. My vagrantfile is as follows

 config.vm.network "forwarded_port", guest: 27017, host: 27016 #mongodb
 config.vm.network "forwarded_port", guest: 1337, host: 1338 #node inspector

 config.vm.network "private_network", ip: "192.168.33.10"

node inspector configuration is as follows

'node-inspector': {
  custom: {
    options: {
      'web-port': 1337,
      'web-host': 'localhost',
      'debug-port': 5858,
      'save-live-edit': true,
      'no-preload': true,
      'stack-trace-limit': 50,
      'hidden': []
    }
  }
},

I am not able to get the node inspector working on my host machine whenever

http://192.168.33.10:1338/debug?port=5858

with vagrant I am able to get the node-inspector working on the local machine without vagrant

When you use static IP you do not need to forward port. Forward port is mainly used when you use bridge adapter. If you go to http://192.168.33.10:1337/debug?port=5858 you should see your inspector

I figured the problems was the number of concurrent tasks configured for grunt-concurrent module. By default its equal to the number of cores in the pc. In my case it was two. So My node-inspecter module configuration in gruntfile.js

 concurrent: {
  default: ['nodemon', 'watch'],
  debug: ['node-inspector', 'nodemon', 'watch'],
  options: {
    logConcurrentOutput: true,
    limit: 5
  }

There is also no debug in the hyperlink .It should be.

http://192.168.33.10:1337/?port=5858

Port forwarding was required for both the ports to get the node inspector

config.vm.network "forwarded_port", guest: 1337, host: 1337   
config.vm.network "forwarded_port", guest: 5858, host: 5858

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM