--- lib/commands/update.js.orig	1985-10-26 01:15:00.000000000 -0700
+++ lib/commands/update.js	2021-03-23 15:13:13.000000000 -0700
@@ -44,6 +44,21 @@
       ? global
       : this.npm.prefix
 
+    // Prevent the npm package in global from updating. Prevent
+    // 'npm update -g' since it'll implicity upgrade npm and also
+    // prevent 'npm update -g npm'.
+    if (this.npm.config.get('global')) {
+      if (!args.length || (args.length && args.find(e => e === 'npm'))) {
+        log.error('update', 'Ignoring attempt to update npm in ' + global);
+        log.error('update', 'which is part of the MacPorts npm10 base');
+        log.error('update', 'installation. To update npm please run:');
+        log.error('update', 'sudo port selfupdate && sudo port upgrade npm10');
+        throw new Error('Ignoring attempt to update npm in ' + global +
+                        ' which is part of the MacPorts npm10 base' +
+                        ' installation.');
+      }
+    }
+
     if (this.npm.config.get('depth')) {
       log.warn('update', 'The --depth option no longer has any effect. See RFC0019.\n' +
         'https://github.com/npm/rfcs/blob/latest/implemented/0019-remove-update-depth-option.md')
