question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Module not found: Error: Can't resolve 'os'

See original GitHub issue
  • Node Version: 8.11.1
  • Npm Version: 5.6.0
  • Platform: Mac OS 10.13.4
  • Package Version: 5.1.3

I am using Contentful with Angular and have set up the service in my project following the instructions here. Everything worked perfectly with Angular 5.x, but I get the following error after upgrading to Angular 6:

ERROR in ./node_modules/contentful-sdk-core/dist/es-modules/get-user-agent.js
Module not found: Error: Can't resolve 'os' in '/Users/dbellizio/Dev/epri/epri-mcr-poc/node_modules/contentful-sdk-core/dist/es-modules'

My project is Angular CLI based, which as of version 6 now uses webpack 4 for the build process. Angular 5 uses webpack 3. So I’m wondering if that has something to do with it. The error occurs when running ng serve or any other Angular CLI build command.

For what it’s worth, I tried upgrading to version 6.1.0 of Contenful, but the error remains.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:20 (11 by maintainers)

github_iconTop GitHub Comments

3reactions
fhackenbcommented, Jan 7, 2019

I got this issue for a different library, but solved it by running npm install --save os

2reactions
Khaledgarbayacommented, May 18, 2018
Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't resolve 'os' , webpack 5 - Stack Overflow
Module not found : Error: Can't resolve 'os' in 'C:\Users\Arex\Desktop\webpack5-react-boilerplate-master\node_modules\xhr2-cookies\dist'.
Read more >
Angular CLI: "Module not found: Error: Can't resolve..."
In this article, I will walk you through how to fix a an error that many people are encountering with Angular CLI 6+....
Read more >
module-not-found - Next.js
Possible Ways to Fix It · The module you're trying to import is not installed in your dependencies · The module you're trying...
Read more >
Resolve | webpack
When enabled, webpack would prefer to resolve module requests as relative requests instead of using modules from node_modules directories. webpack.config.js
Read more >
module not found: can't resolve imported dependency "fs"
Jul 23, 2019 ... The error is because of angular-cli does not support modules in node like "fs" and "path". (Issue). Add the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found