30 April 2017

Node.js Install Secific from NPM or Git

Whilst carrying out an upgrade of an Angular2 to v4 andfollowing  instructions on the Angular blog "Updating to 4.0.0" I ran the npm install command to update Angular2 to 4:
npm install @angular/common@latest @angular/compiler@latest @angular/compiler-cli@latest @angular/core@latest @angular/forms@latest @angular/http@latest @angular/platform-browser@latest @angular/platform-browser-dynamic@latest @angular/platform-server@latest @angular/router@latest @angular/animations@latest typescript@latest --save

However you get the error:
npm WARN @angular/core@4.1.0 requires a peer of zone.js@^0.8.4 but none was installed.

Trouble is the latest version of zone.js on Git was v0.8.9 when we need 0.8.4

Install Specific Version From NPM

You can install a specific version from npm:
npm install <package>@<version>
npm install zone@0.8.4 --save

Install Specific Version from Git

To install the specific tag from Git directly run:
npm install git+https://github.com/angular/zone.js.git#v0.8.4 --save

Note the format: git+; then the github normal clone url; a hash; a v; the tag name; and --save to set it in project.json

No comments:

Post a Comment