In the new versions of node, node-inspector is built in and can be fired using the command node --inspect index.js
. However, this always provides a command line
Yes!! Use Node.js V8 --inspector Manager (NiM) Chrome plugin, it opens Chrome automagically when I run node --inspect-brk app
On a side note - debugging with Visual Studio Code has become a breeze
npm install express
npm install esm
npm install open
npm install --save-dev node-key-sender
package.json
{
"name": "open-browser",
"version": "1.0.0",
"description": "browser",
"main": "server.js",
"type": "module",
"scripts": {
"esm": "node -r esm server.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"express": "^4.17.1",
"esm": "^3.2.25",
"open": "^7.0.0",
},
"devDependencies": {
"node-key-sender": "^1.0.11"
}
}
server.js
import express from 'express'
import http from 'http'
import open from 'open'
import keysender from 'node-key-sender'
const webApp = express()
const webServer = http.createServer(webApp)
webServer.listen(3000, function(){
console.log('> Server listening on port:',3000)
open('http://localhost:3000')
keysender.sendCombination(['control', 'shift', 'i'])
})
the browser must already be open, then run
node -r esm server.js
This is not possible, for multiple reasons.