How to setup node-inspector with vagrant?

好久不见. 提交于 2019-12-23 04:04:13

问题


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


回答1:


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




回答2:


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


来源:https://stackoverflow.com/questions/36536753/how-to-setup-node-inspector-with-vagrant

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!