Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't resolve os in file [index.js] #54

Closed
shengshiqi opened this issue Jan 18, 2018 · 10 comments
Closed

Can't resolve os in file [index.js] #54

shengshiqi opened this issue Jan 18, 2018 · 10 comments

Comments

@shengshiqi
Copy link

in line 73, required module os, but not found in package.json.

@shengshiqi shengshiqi changed the title Can't resolve os in file index.js Can't resolve os in file [index.js] Jan 18, 2018
@DamonOehlman
Copy link
Owner

@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.

@shengshiqi
Copy link
Author

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?

@markgoho-EDT
Copy link

markgoho-EDT commented May 4, 2018

Getting this as well in an Angular project. v6

workaround: installed os as a dev dependency in my project

@DamonOehlman
Copy link
Owner

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.

@damsorian
Copy link

I have the same issue

@edaniels
Copy link

edaniels commented Jul 1, 2018

@DamonOehlman do you think you can release a major version bump for this this month? Thanks!

@DamonOehlman
Copy link
Owner

DamonOehlman commented Jul 4, 2018

@edaniels definitely - keen to get it through ASAP. Having a look at #70 again now. I think I can do this in a 3.1.x release anyway as it is now a non-breaking change. Going to rollout out 3.0.0 now.

@DamonOehlman
Copy link
Owner

Done :)

@edaniels
Copy link

edaniels commented Jul 4, 2018

Thanks!

@5punk
Copy link
Collaborator

5punk commented Sep 15, 2018

Closing as inactive.

@5punk 5punk closed this as completed Sep 15, 2018
tomonari-t pushed a commit to tomonari-t/detect-browser that referenced this issue Jan 31, 2019
…mponentUpdate methods (DamonOehlman#54)

* Remove the unused variable lastIsDark

* Use React.PureComponent instead of custom shouldComponentUpdate methods
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants