Deploying a Node.JS application to Azure Web App Service

If you deployed your Node.JS app to Azure and you can’t get it to run, a common gotcha is the port number your app is listening on. When troubleshooting, you may be reading that Azure allows incoming connections only to ports 80 and 443. So you make your app listen to 80 or 443, but… Continue reading Deploying a Node.JS application to Azure Web App Service

nvm, npm, node: Command not found

The problem I had gatsbyjs, node and npm installed on a Debian system. Now I’m getting this error: -bash: gatsby: command not found -bash: node: command not found -bash: npm: command not found Troubleshooting Check npm installation using the package manager: apt-cache policy npm npm: Installed: (none) Check nvm installation: nvm –version 0.39.3 This means… Continue reading nvm, npm, node: Command not found

Add nvm-managed node to $PATH in init.d or crontab

When I was using node installed via apt-get, a simple NODE=$(which node) was enough. However, once I switched to the nvm-based node, it was no longer installed in one of the $PATH locations where the system is looking. So the correct path had to be added manually. One option is to hardcode whatever the current… Continue reading Add nvm-managed node to $PATH in init.d or crontab

Simulating Hard Websocket Disconnect in a Browser

I need to test ping pong detecting a connection loss. Unline a soft, programmatical disconnect (.close()), a hard disconnect means network connection loss and won’t notify the websocket server. Chrome’s built-in network throttle doesn’t affect the existing, already established websocket connections – even with the latest (Feb 2022) update on the issue. My setup is… Continue reading Simulating Hard Websocket Disconnect in a Browser

Changing the Node.js inspector port in phpStorm

You can launch the Node.js debugger when working with Node.js inside phpStorm /bin/node –inspect-brk=0.0.0.0:50407 /var/www/example.js Debugger listening on ws://0.0.0.0:50407/49a2d585-05b1-438e-a53c-6b2943c684df For help, see: https://nodejs.org/en/docs/inspector Debugger attached. This also starts the node inspector you can open in Google Chrome, but it uses a random port every time you relaunch the debugger. This may be an issue if… Continue reading Changing the Node.js inspector port in phpStorm