The Node and browser environments provide different functions, in addition to the process (Node-only) and window (browser-only) objects. If you want an NPM package to work on both, there's a way to specify different source files in the package.json file:
{
...
"browser": {
"./node-file.js": "./browser-replacement.js",
},
}
...
"browser": {
"./node-file.js": "./browser-replacement.js",
},
}