NodeJS + NPM “Cannot find module”

TL;DR: install your NPM packages globally. Like this (where “homebridge” is whatever package you are installing):

sudo npm install homebridge -g

This was driving me crazy. I have been trying to install a couple of NPM packages with dependencies, and run them at startup as a service on an Ubuntu server. I knew the packages weren’t ending up in the right place (even when run as sudo), but I couldn’t figure out why.

Using the -g (global) option cleared everything back up. Now all the dependencies are installed for all users, and my service starts without errors.

The errors were like these:

Error: Cannot find module 'request'

Continue reading

Can’t Send Outgoing Mail (Virtualmin + Postfix)

After a recent operating system update on my Virtualmin server, outgoing emails (accounts, forwarding, system generated) stopped working. Connections to the SMTP server worked fine, authentication had no issues, and mail could be sent locally to domains on the same server.

But when trying to mail to on external address (Gmail for example), the mail client and mail logs showed an error: “Relay access denied”. It took quite a while to discover the offending settings so I thought I’d share what worked for me (finally) here.

Postfix_logo

Near the end of the /etc/postfix/main.cf you should ensure the settings are as follows:

smtpd_sasl_auth_enable = yes
#smtp_sasl_auth_enable = yes

Where ‘smtp_sasl_auth_enable” is commented out. After making this change I was again able to send mail to external domains.

Make sure you test your setup to a few different mail providers though. The update enabled IPv6 for my Postfix server, and because I don’t have reverse DNS for IPv6 enabled on my server Gmail rejected all mail. You might also wish setup reverse DNS for IPv6, or make the following change so that only IPv4 is used:

inet_protocols = ipv4

VirtualBox “Failed to load..”

Lately I’ve been using the wonderful VirtualBox software to run my Windows virtual machines (Internet Explorer testing etc). It’s just about as good as Parallels or Fusion, but its completely free and open source. What’s not to love?

But once and a while I run into strange errors when trying to boot my VM’s. Errors like “VERR_SUPLIB_WORLD_WRITABLE”, which basically mean the file permissions on some component of VirtualBox are too general.

You can fix most of these errors by opening up Disk Utility (Spotlight search or Applications > Utilities). From there select your system hard drive (likely Macintosh HD) and click Repair Disk Permissions. This process may take a few minutes. When its done restart your computer, open up VirtualBox and you should be good to go!

If you still have trouble, open up the Applications folder and find the VirtualBox app. Right click and open the Get Info screen. At the bottom in the permissions section, make sure “Everyone” only has read access.

Header screenshot by Rafa Espada.