--- node-v18.0.0.orig/src/node_main.cc	2022-04-21 15:15:47.131869784 +0530
+++ node-v18.0.0/src/node_main.cc	2022-05-19 17:59:43.234596999 +0530
@@ -124,6 +124,10 @@
   // calls elsewhere in the program (e.g., any logging from V8.)
   setvbuf(stdout, nullptr, _IONBF, 0);
   setvbuf(stderr, nullptr, _IONBF, 0);
+  if(getenv("TMPDIR") == NULL) {
+    // Give javascript programs (such as updated versions of npm) a working tmpdir.
+    putenv("TMPDIR=@TERMUX_PREFIX@/tmp");
+  }
   return node::Start(argc, argv);
 }
 #endif
