thisライブラリを角度2のアプリケーションにインポートする方法を理解しようとしています。角度2のアプリでこのライブラリを使用しようとしています
私は多くのことを試しましたが、うまくいかないようです。以下は私の部分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'
}
}
これは私が
import * as youtubedl from 'youtube-dl';
私は常にこのエラーになるように見える私のvideo.service.tsにインポートしようとしている方法である
app/service/video.service.ts(2,28):エラーTS2307: 'youtube-dl'モジュールが見つかりません。以下は
私の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"
}
}
がNPM LSを行なったし、[email protected]記載されているだけでなく
あなたはノードの依存関係としてそれをインポートすることはできませんapp.module.tsインポートリストにあなたのappModleでユーチューブモジュールを追加したことを確認してください見つからないエラーを示しますか?あなたはすでにそれを利用しているようです。 – Makoto
私はこのエラーの結果を試しても何の問題もありません。 app/service/video.service.ts(2,28):エラーTS2307: 'youtubedl'モジュールが見つかりません。 – kotsumu
質問を編集し、その情報を含める必要があります。注目すべきものであるNPMを使用できない場合。また、その試みであなたのpackage.jsonを含めてください。 – Makoto