I'm trying to figure out how to import this library into my angular 2 application.
I've tried many things but can't seem to get it to work. Below is my partial systemjs.config.js
System.config({
paths: {
// paths serve as alias
'npm:': 'node_modules/'
},
// map tells the System loader where to look for things
map: {
// our app is within the app folder
app: 'app',
// angular bundles
.... // Removed to conserve space
// other libraries
'rxjs': 'npm:rxjs',
'angular-in-memory-web-api': 'npm:angular-in-memory-web-api',
'youtube-dl': 'npm:youtube-dl'
},
// packages tells the System loader how to load when no filename and/or no extension
packages: {
app: {
main: './main.js',
defaultExtension: 'js'
},
rxjs: {
defaultExtension: 'js'
},
'angular-in-memory-web-api': {
main: './index.js',
defaultExtension: 'js'
},
'youtube-dl': {
main: './lib/youtube-dl.js',
defaultExtension: 'js'
}
}
This is how I'm trying to import it into my video.service.ts
import * as youtubedl from 'youtube-dl';
I seem to always result into this error
app/service/video.service.ts(2,28): error TS2307: Cannot find module 'youtube-dl'.
Below is my package.json
{
...,
...,
...,
"dependencies": {
"@angular/common": "~2.0.1",
"@angular/compiler": "~2.0.1",
"@angular/core": "~2.0.1",
"@angular/forms": "~2.0.1",
"@angular/http": "~2.0.1",
"@angular/platform-browser": "~2.0.1",
"@angular/platform-browser-dynamic": "~2.0.1",
"@angular/router": "~3.0.1",
"@angular/upgrade": "~2.0.1",
"angular-in-memory-web-api": "~0.1.1",
"core-js": "^2.4.1",
"reflect-metadata": "^0.1.8",
"rxjs": "5.0.0-beta.12",
"systemjs": "0.19.39",
"zone.js": "^0.6.25",
"bootstrap": "^4.0.0-alpha.2",
"font-awesome": "^4.6.1",
"youtube-dl": "1.11.1"
},
"devDependencies": {
"concurrently": "^3.0.0",
"electron": "1.4.2",
"typescript": "^2.0.3",
"typings":"^1.4.0"
}
}
Did a npm ls and did see youtube-dl@1.11.1 listed as well