When using nodebrew to switch between certain Node.js versions, the following error message may appear
nodebrew use v8.9.4
Use of uninitialized value $a1 in numeric comparison (<=>) at /usr/local/bin/nodebrew line 675.This error is often caused by a macOS-specific hidden file called .DS_Store. The . DS_Store file is automatically generated by macOS to store metadata such as folder icon locations and background colors.
The above error can be addressed by deleting the . DS_Store file. The specific command is as follows
rm ~/.nodebrew/node/.DS_StoreThis will allow nodebrew to work properly. This solution is also shared on an external Gist. Reference links