Use the standard `extern char **environ' instead. Fixes an issue with macOS. Also, check that env is not NULL in js_init.