1

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 ?

5
  • 1
    If you were using the old HttpModule, it's been deprecated since v4 in favour of HttpClientModule, and was removed in v6 Commented May 17, 2018 at 8:21
  • Nope, I use only HttpClientModule. The problem is somewhere else. Commented May 17, 2018 at 8:31
  • Maybe one of your dependencies? Commented May 17, 2018 at 8:34
  • http is a default package in node.js. Just for debugging purpose, Open node.js in terminal & type http.get. What you're getting ? any object? Commented May 17, 2018 at 9:06
  • Then I have: http.get -> [Function: get] Commented May 17, 2018 at 9:29

1 Answer 1

1

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?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.