Node changed some signatures, behaviors, and error handling here in recent versions. As far as I can tell:
- The script.runInNewContext(...) method has never taken a path parameter, and passing the path has always been wrong.
- The script.runInNewContext(...) method started taking an [options] parameter at some point, and validating it, so the bad path parameter now throws.
- vm.createScript(...) is "soft deprecated" but basically fine, and keeping it looks more compatible.
This seems like the smallest and most compatible correct change.