Search code examples
npmangularnpm-installangular2-meteor

Issues installing angular2-meteor with npm


Trying to start a new angular2-meteor project using

npm install angular2-meteor --save

Get a whole bunch of red errors (below) and I am not sure what they mean. I have already done
npm install npm -g
and
npm update -g
Here's the error:
enter image description here


Solution

  • I think you followed the Quick Start here.

    angular2-meteor package has not been exposed to NPM yet. Check this issue

    UPDATE:

    Refer here and here for latest tutorial.

    Now you can install, follow these steps:

    1. Update your meteor globally (If you already updated, then no need to do it again. And go here to check if there is a new version).

      meteor update --release 1.3-rc.4

    2. Run these in your terminal to create an angular2-meteor1.3 project:

      meteor create --release 1.3-rc.4 hello

      cd hello

      npm install https://github.com/Urigo/angular2-meteor --save

      npm install https://github.com/Urigo/angular2-meteor-auto-bootstrap --save

      meteor remove blaze-html-templates

      meteor add angular2-compilers

    3. Remove main.js, main.html, main.css files in the client folder.

    4. Then create these two files in your client folder:

    // app.ts

    import 'reflect-metadata';
    import { bootstrap } from 'angular2-meteor-auto-bootstrap'
    import { Component } from 'angular2/core';
    
    @Component({
      selector: 'app',
      template: `<p>Hello World!</p>`
    })
    class App {}
    bootstrap(App);
    

    (Make sure you put import 'reflect-metadata'; first line before other import, otherwise it won't work.)

    // index.html

    <head>
      <title>Hello</title>
    </head>
    <body>
    <app></app>
    </body>
    

    At last, run meteor in the terminal and go to http://localhost:3000 to check your app.