Solvedangular 4.0.0-rc.6 [platform-server] - Cannot find module '@angular/animations/browser'. & other errors

[x] bug report => search github for a similar issue or PR before submitting

Current behavior
When upgrading from rc5 to rc6 these errors now pop-up from the generated typings within Angular platform-browser & platform-server.

ERROR in C:/Users/mark.pieszak/Documents/GitHub/ng-universal-demo/node_modules/@angular/platform-browser/animations/src/animation_renderer.d.ts (1,53): Cannot find module '@angular/animations/browser'.)

    ERROR in C:/Users/mark.pieszak/Documents/GitHub/ng-universal-demo/node_modules/@angular/platform-browser/animations/src/providers.d.ts (8,276): Cannot find module '@angular/animations/browser'.)

    ERROR in C:/Users/mark.pieszak/Documents/GitHub/ng-universal-demo/node_modules/@angular/platform-server/src/server.d.ts (8,34): Cannot find module '@angular/animations/browser'.)

    ERROR in Error encountered resolving symbol values statically. Could not resolve @angular/animations/browser relative to C:/Users/mark.pieszak/Documents/GitHub/ng-universal-demo/node_modules/@angular/platform-server/platform-server.d.ts., resolving symbol ɵSERVER_RENDER_PROVIDERS in C:/Users/mark.pieszak/Documents/GitHub/ng-universal-demo/node_modules/@angular/platform-server/platform-server.d.ts, resolving symbol ServerModule in C:/Users/mark.pieszak/Documents/GitHub/ng-universal-demo/node_modules/@angular/platform-server/platform-server.d.ts, resolving symbol ServerModule in C:/Users/mark.pieszak/Documents/GitHub/ng-universal-demo/node_modules/@angular/platform-server/platform-server.d.ts

    ERROR in ./~/@angular/platform-server/@angular/platform-server.es5.js
    Module not found: Error: Can't resolve '@angular/animations/browser' in 'C:\Users\mark.pieszak\Documents\GitHub\ng-universal-demo\node_modules\@angular\platform-server\@angular'
     @ ./~/@angular/platform-server/@angular/platform-server.es5.js 13:0-63
     @ ./src/app/server-app.module.ts
     @ ./src/main.server.ts

    ERROR in ./~/@angular/platform-browser/@angular/platform-browser/animations.es5.js
    Module not found: Error: Can't resolve '@angular/animations/browser' in 'C:\Users\mark.pieszak\Documents\GitHub\ng-universal-demo\node_modules\@angular\platform-browser\@angular\platform-browser'
     @ ./~/@angular/platform-browser/@angular/platform-browser/animations.es5.js 13:0-249
     @ ./~/@angular/platform-server/@angular/platform-server.es5.js
     @ ./src/app/server-app.module.ts
     @ ./src/main.server.ts

Expected behavior
No errors

Minimal reproduction of the problem with instructions
Repro here: https://github.com/markpieszak/ng-universal-demo/tree/rc6-error
yarn install && npm start

  • Angular version:

4.0.0-rc.6

12 Answers

✔️Accepted Answer

(Just incase others find it)
Make sure @angular/animations is installed as a dependency, and the errors will go away.

npm i --S '@angular/animations' 

Other Answers:

Try this command
npm install '@angular/animations' -- save

platform-server now needs @angular/animations as peer dependency. npm install should show an error if you don't have that in your dependencies.

From http://angularjs.blogspot.fr/2017/03/angular-400-now-available.html

Animation Package
We have pulled animations out of @angular/core and into their own package. This means that if you don’t use animations, this extra code will not end up in your production bundles.
This change also allows you to more easily find documentation and to take better advantage of autocompletion. You can add animations yourself to your main NgModule by importing BrowserAnimationsModule from @angular/platform-browser/animations.

More Issues: