New blog domain: kula.blog

It's still work in progress but new posts will be published on  https://kula.blog/ Thanks to 11ty base blog RSS is working from the start so it should be easy to add to your reader if you still use any :) If now then I hope you can sign up to the newsletter where I'll be publishing new posts and interesting articles to it from time to time. Please use  kula.blog  from now on.

Convenient Node Debugger Run by NPM


If you read installation instruction of node-inspector you would think that the only way to use it is to install it globally. Here I want to suggest embedding it in the project.

Installation:

$ npm install -g node-inspector
$ npm install node-inspector --devDependencies

After doing that, you need to add "debug" line to "scripts" part of package.json

"scripts": {
    "start": "node app.js",
    "debug": "./node_modules/.bin/node-debug app.js" }

And run it:

$ node-debug app.js
$ npm run debug


It has downsides, that is obvious, but in my opinion it has also big advantages. 

New person on the team does not need to follow long readme of global modules to install - and remember how all of them are supposed to be run. Another advantage is ignoring all the problems that you may have with sudo (needing it to install anything global). In my opinion it is also simpler and more convenient. All commands can be scripts starting with $ npm run *.

Of course it has some downsides as well. In case of many projects you would need to install and update the same module in every project. "NPM run debug" is yet another thing that must be stated in readme or being part of team culture as known part of every project to be most useful, and the last one: anyone using IDE will still need to install it even knowing they are not going to ever use it. 

If you like this idea, give it a try :)

Comments

Popular posts from this blog

How to simulate slow connection (developer proxy in Node.js)

Safari Mobile CSS VW and VH units bug.