npm package.json OS specific dependency
问题 Is there a way to specify OS specific dependencies in a npm package.json file? For example, I would only want to install 'dbus' (https://npmjs.org/package/dbus) as a dependency for my module if the user is running Linux. I would have a different dependency for Mac and Windows. 回答1: There's a possible good way of doing this, depending on your setup. npm package.json supports an os key, and also optionalDependencies os can be used to specify which OS a module can be installed on.