npm ERR! peerinvalid

EPeerInvalidI have encountered this problem while creating my first project in Angular2. As I have spent some time figuring out what has been going on, it should be a good idea to share the solution.

A good practice is to use Typescript in Angular2. When I tried to install it by NPM, I got the following error:


C:\Git\Angular2TestProject>npm install -g typescript
C:\Users\DbaPresents\AppData\Roaming\npm\tsc -> C:\Users\DbaPresents\AppData\Roaming\npm\node_modules\typescript\bin\tsc
C:\Users\DbaPresents\AppData\Roaming\npm\tsserver -> C:\Users\DbaPresents\AppData\Roaming\npm\node_modules\typescript\bin\tsserver
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "typescript"
npm ERR! node v4.6.0
npm ERR! npm v2.15.9

npm ERR! peerinvalid The package @angular/compiler@2.1.0 does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer @angular/compiler-cli@0.6.4 wants @angular/compiler@2.0.2
npm ERR! peerinvalid Peer @angular/platform-server@2.1.0 wants @angular/compiler@2.1.0

npm ERR! Please include the following file with any support request:
npm ERR! C:\Git\Angular2TestProject\npm-debug.log

Updating NPM fixes the problem. Here are the steps that did it for me:

  1. Manually delete the following directory C:\Users\DbaPresents\AppData\Roaming\npm-cache.
  2. Execute this command:
    npm install npm@latest -g


Read more

I have also seen a different error from NPM - npm ERR! code ERR_STREAM_WRITE_AFTER_END.