angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Can't install ng2-bootstrap or any other library.

Open leonel-torrealba opened this issue 10 years ago • 7 comments

Please provide us with the following information:

  1. OS? Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?) El Capitan
  1. Versions. Please run ng --version. If there's nothing outputted, please run in a Terminal: node --version And paste the result here. angular-cli: 1.0.0-beta.1 node: 4.2.6

  2. Repro steps. Was this an app that wasn't created using the CLI? What change did you do on your code? etc. Just create a new project and try to install any new library. I even try to install moment following your steps and is not working.

  3. The log given by the failure. Normally this include a stack trace and some more information.

  4. Mention any other details that might be useful.


    Thanks! We'll be in touch soon.

leonel-torrealba avatar May 18 '16 12:05 leonel-torrealba

I'm using moment and ng2-bootstrap without issues. My system-config

const map: any = { 'moment': 'vendor/moment/moment.js', 'ng2-bootstrap': 'vendor/ng2-bootstrap' };

/* User packages configuration. / const packages: any = { 'vendor/ng2-bootstrap': { defaultExtension: 'js' } }; My angular build-cli module.exports = function(defaults) { return new Angular2App(defaults, { vendorNpmFiles: [ 'systemjs/dist/system-polyfills.js', 'systemjs/dist/system.src.js', 'zone.js/dist/.js', 'es6-shim/es6-shim.js', 'reflect-metadata/.js', 'rxjs/__/.js', '@angular/**/.js', 'ng2-bootstrap/**/*.js', 'moment/moment.js' ] }); };

BenevidesLecontes avatar May 18 '16 13:05 BenevidesLecontes

Thanks so much for your quick answer.

I'm still having troubles... I tried the configuration you provied. And it's throwing this error.

screen shot 2016-05-18 at 9 13 32 am

Then i tried with this configuration. (i'm just going to copy the import statement)

angular-cli-build.js 'ng2-bootstrap/bundles/ng2-bootstrap.js',

system.config.js

const map: any = { 'moment': 'vendor/moment/moment.js', 'ng2-bootstrap': 'vendor/ng2-bootstrap/bundles' };

/** User packages configuration. */ const packages: any = { 'vendor/ng2-bootstrap/bundles': { defaultExtension: 'js' } };

And I'm having this error: screen shot 2016-05-18 at 9 17 34 am

And in both cases this is my component:

import { Component } from '@angular/core'; import {AlertComponent} from 'ng2-bootstrap/ng2-bootstrap'; @Component({ moduleId: module.id, selector: 'coworking-app', templateUrl: 'coworking.component.html', directives: [AlertComponent], styleUrls: ['coworking.component.css'] }) export class CoworkingAppComponent { title = 'coworking works!'; }

I tried importing the bundle file because they do that in the example provided here:

https://github.com/valor-software/angular2-quickstart/blob/master/index.html

thanks for your answer and sorry to bother.

leonel-torrealba avatar May 18 '16 14:05 leonel-torrealba

Don't use bundles or try to debug where are these files.

BenevidesLecontes avatar May 19 '16 08:05 BenevidesLecontes

@liongoncalves Where you able to solve the errors you were getting? I am asking as I am getting similar error. Any help in the right direction will be great.

tushar-chauhan avatar May 25 '16 14:05 tushar-chauhan

@tushar-chauhan yeah i manage to kinda solve the error. I'm not 100% percent happy with the solution but it works for now. You can check what i did here in this repo. Is a personal project so for me works. But for example. I'm importing the bootstrap css (and other css too) in the index.html file directly, and well i really don't like that, in fact any "global" I'm importing this way (if anyone have a better way to do this with systemjs directly it would be great).

For ng2-bootstrap just check my angular-cli-build.js and app/system.config.js file. In there is most of the configuration. Then just import the component you need to use import {AlertComponent} from 'ng2-bootstrap/ng2-bootstrap'; for example. And that's it.

If you have another question feel free to ask.

leonel-torrealba avatar May 25 '16 14:05 leonel-torrealba

@liongoncalves thanks for you repo's link. It worked 😄

tushar-chauhan avatar May 25 '16 15:05 tushar-chauhan

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.