Fix Invalid Package Name “.DS_Store” for Node.js NPM Global Update on macOS

If you got the following error message when run npm update -g:

$ npm update -g
npm ERR! code EINVALIDPACKAGENAME
npm ERR! Invalid package name ".DS_Store": name cannot start with a period

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/sparanoid/.npm/_logs/2021-04-28T13_59_32_013Z-debug.log

Simply run if you installed your Node.js via Homebrew:

find /usr/local -name '.DS_Store' -type f -print -delete

Or the following for M1:

find /opt/homebrew/lib -name '.DS_Store' -type f -print -delete