I'm following the 3rth party library installation guide but for underscore, I basically do that same but instead of every 'moment' I replace it with 'underscore', just had to install the typings with typings install dt~underscore --global --save, but the compiler wont find underscore.
The Broccoli Plugin: [BroccoliTypeScriptCompiler] failed with:
Error: Typescript found the following errors:
/home/franco/Repositories/freyja-estore/tmp/broccoli_type_script_compiler-input_base_path-LIIKQ8Cj.tmp/0/src/app/freyja-api/basket-api.ts (6, 20): Cannot find module 'underscore'.
at BroccoliTypeScriptCompiler._doIncrementalBuild (/home/franco/Repositories/freyja-estore/node_modules/angular-cli/lib/broccoli/broccoli-typescript.js:115:19)
at BroccoliTypeScriptCompiler.build (/home/franco/Repositories/freyja-estore/node_modules/angular-cli/lib/broccoli/broccoli-typescript.js:43:10)
at /home/franco/Repositories/freyja-estore/node_modules/angular-cli/node_modules/broccoli-caching-writer/index.js:152:21
at lib$rsvp$$internal$$tryCatch (/home/franco/Repositories/freyja-estore/node_modules/angular-cli/node_modules/broccoli-caching-writer/node_modules/rsvp/dist/rsvp.js:1036:16)
at lib$rsvp$$internal$$invokeCallback (/home/franco/Repositories/freyja-estore/node_modules/angular-cli/node_modules/broccoli-caching-writer/node_modules/rsvp/dist/rsvp.js:1048:17)
at lib$rsvp$$internal$$publish (/home/franco/Repositories/freyja-estore/node_modules/angular-cli/node_modules/broccoli-caching-writer/node_modules/rsvp/dist/rsvp.js:1019:11)
at lib$rsvp$asap$$flush (/home/franco/Repositories/freyja-estore/node_modules/angular-cli/node_modules/broccoli-caching-writer/node_modules/rsvp/dist/rsvp.js:1198:9)
at nextTickCallbackWith0Args (node.js:420:9)
at process._tickCallback (node.js:349:13)
Moment seems to work fine though
My ng --version:
angular-cli: 1.0.0-beta.5
node: 4.4.4
os: linux x64
Thanks!
Have a some problem with jquery
I think this not a mistake of ng-cli, but you, guys, can help us :)
My solution: include your library directly in index.html.
<script src="vendor/jquery/dist/jquery.js"></script>
Or as a dependency of main in system-config.ts.
And remove import in ...component.ts
But i'm sure there's is a better decision.
@MNBuyskih How would you then reference it in for example a component? Using the typings $?
@RicardoVaranda yes, you can use $, but $ confict with protractor's $. See https://github.com/DefinitelyTyped/DefinitelyTyped/issues/2734
But jQuery is available.
Yea I just ran into that issue couple of hours ago and can confirm jQuery worked fine, hope the implementation is made easier down the line as it seems like more of a work around rather than a fix.
If you include your library inside index.html your production build probably won't work. It is better to include it within angular-cli.build.js, and declare it as a "Global" module in system-config.ts. I think you will need the import within the component file in order for SystemJS to register the module
The wiki page is in-correct for the /// reference it should be
/// <reference path="../../typings/globals/underscore/index.d.ts" />
not three sets of dots.
Also
import * as _ from 'underscore'
Closed as obsolete following #1455.
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._