Damian Roszyk
Damian Roszyk

Reputation: 11

Module not found: Error: Can't resolve 'http' - @angular-devkit/core

after updating project to ng v6 I've got a problem with compilation

ERROR in ./node_modules/@angular-devkit/core/src/json/schema/registry.js Module not found: Error: Can't resolve 'http' in 'C:\Users\Damian Roszyk\WebstormProjects\BizzLayerClient\node_modules\@angular-devkit\core\src\json\schema' i 「wdm」: Failed to compile.

ng -v:

Angular CLI: 6.0.3 
Node: 10.1.0 OS: win32 x64 
Angular: 6.0.2
... animations, common, compiler, core, forms, http
... platform-browser, platform-browser-dynamic, platform-server
... router

@angular-devkit/architect 0.6.3
@angular-devkit/build-angular 0.6.3 
@angular-devkit/build-optimizer 0.6.3
@angular-devkit/core 0.6.3
@angular-devkit/schematics 0.6.3
@angular/cli 6.0.3
@angular/compiler-cli 6.0.2
@ngtools/webpack 6.0.3
@schematics/angular 0.6.3
@schematics/update 0.6.3
rxjs 6.1.0
typescript 2.7.2
webpack 4.8.3

Does anyone encountered same problem and know how to solve it ?

Upvotes: 1

Views: 2697

Answers (1)

Michael buller
Michael buller

Reputation: 586

The Angular CLI team say's this is intended behavior, as browser code can't depend on nodejs environment being present. They describe the situation here... https://github.com/angular/angular-cli/issues/11130

The issue that many of us face is that the libraries we use today may not have upgraded or prepared for this. In some cases, they may not be actively being updated. The Angular team has added a lot of desired functionality to the new version 6, however, this line in the sand with no real description about how to actively solve the issue will prevent many from moving forward.

One person mentions creating two different node folders, one for Angular and one for the middleware, example ... hapi/joi.js and jaydata-odata. Does anyone else have additional suggestions about how to hide away the dependencies of our dependencies from the Angular build?

Upvotes: 1

Related Questions