Can't resolve `os` in file [index.js]
shengshiqi opened this issue · comments
in line 73, required module os
, but not found in package.json.
@shengshiqi Can you provide some more information around how you are trying to use detect-browser
please? This shouldn't be an error that occurs when using either browserify
or in node, but there may be some other package bundlers that don't like it. Happy to investigate those cases.
node version: 7.6.0, package bundlers: FIS, TERMINAL print [WARNI] Can't resolve os
in file [/node_modules/detect-browser/index.js], did you miss npm install os
?
Getting this as well in an Angular project. v6
workaround: installed os
as a dev dependency in my project
Looks like I need to perform a better "is node" check. Currently the test is:
var isNode = typeof navigator === 'undefined' && typeof process !== 'undefined';
Which seems to be firing false positives in particular environments (Angular v6 being one example). Alternatively, perhaps I should consider removing the ability to detect if the code is running on the server at all. I doubt it's being used by many people and as long as it's done in a major version bump that should be acceptable.
I'd prefer that you don't have to add a workaround like adding os
as a dev dep to your project.
I have the same issue
@DamonOehlman do you think you can release a major version bump for this this month? Thanks!
Done :)
Thanks!
Closing as inactive.