2016-12-18 11 views
0

githubプロジェクトをダウンロードしましたVisual Studio 2015 Update 3を搭載したマシンのASP.NET CoreプロジェクトでTypeScriptとAngular 2を学びたいと思います。既存の角型2 Typescript ASP.NETコアプロジェクトにノードを追加する方法

私は最初にMicrosoft.TypeScript.MSBuild 1.8.11 nugetパッケージをインストールした後でプロジェクトをコンパイルできます。しかし、失敗したnode_modulesパッケージの404ブラウザ・コンソール・エラーをロードできませんでした。このフォルダは私のソリューションには存在しません。

私は、systemjs.config.jsというファイル参照のnpmとnode_modulesに気付きました。

/** 
* System configuration for Angular samples 
* Adjust as necessary for your application needs. 
*/ 
(function (global) { 
    System.config({ 
     paths: { 
      // paths serve as alias 
      'npm:': '/node_modules/', 
      'tether': '/Scripts/lib/tether.js' 
     }, 
     // map tells the System loader where to look for things 
     map: { 
      // our app is within the app folder 
      app: '/Scripts', 
      // angular bundles 
      '@angular/core': 'npm:@angular/core/bundles/core.umd.js', 
      '@angular/common': 'npm:@angular/common/bundles/common.umd.js', 
      '@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js', 
      '@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js', 
      '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js', 
      '@angular/http': 'npm:@angular/http/bundles/http.umd.js', 
      '@angular/router': 'npm:@angular/router/bundles/router.umd.js', 
      '@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js', 
      '@ng-bootstrap/ng-bootstrap': 'npm:/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js', 
      // other libraries 
      'ng-lightning/ng-lightning': 'npm:ng-lightning/bundles/ng-lightning.umd.js', 
      'primeng': 'npm:primeng', 
      'lodash': 'npm:lodash', 
      'rxjs': 'npm:rxjs' 
     }, 
     // packages tells the System loader how to load when no filename and/or no extension 
     packages: { 
      app: { 
       main: './main.js', 
       defaultExtension: 'js' 
      }, 
      primeng: { 
       defaultExtension: 'js' 
      }, 
      'ng-lightning': { 
       defaultExtension: 'js' 
      }, 
      lodash: { 
       main: 'index.js', 
       defaultExtension: 'js' 
      }, 
      rxjs: { 
       defaultExtension: 'js' 
      } 
     } 
    }); 
})(this); 

しかし、githubプロジェクトにはノードが動作するためのノード、gulp、bowerまたはnpmはありません。 デフォルトのVisual Studio 2015 ASP.NET Coreアプリケーションを作成して、デフォルトで作業ノードを追加しても、元のgithubの作成者がチェックインしていない既存のプロジェクトにノードを追加する方法はわかります。

My tsconfig typeRoots ':「不明なコンパイラオプションtypes'.VSTSC
ビルド' 不明なコンパイラオプション:.jsonファイルも

{ 
    "compileOnSave": true, 
    "compilerOptions": { 
    "target": "es5", 
    "module": "commonjs", 
    "moduleResolution": "node", 
    "sourceMap": true, 
    "emitDecoratorMetadata": true, 
    "experimentalDecorators": true, 
    "removeComments": false, 
    "noImplicitAny": false, 
    "typeRoots": [ 
     "node_modules/@types" 
    ], 
    "types": [ 
     "core-js" 
    ] 
    } 
} 

コンパイルできないと私は

ビルド得ます。 VSTSC

+0

答えはありませんが、マイクロソフトの[JavaScript Services](https://github.com/aspnet/JavaScriptServices)リポジトリもご覧ください。これにより、[angular-2テンプレート](http://blog.stevensanderson.com/2016/10/04/angular2-template-for-visual-studio/)のようにasp.netコア用の公式SPAテンプレートが強化されます。 –

答えて

0

npmの依存関係をインストールするには、ノードをマシンにグローバルにインストールする必要があります。

ノードがインストールされている場合。 npm install プロジェクトのルートフォルダ

+0

私はそれを持っていますが、他に何かがありません。 node_modulesが作成されていないため、ノードパッケージの404エラーが発生します。 – dev2go

+0

は、 "npm install"を実行するフォルダ内のpackage.jsonですか? –

関連する問題