2017-06-10 23 views
2

私のアンジェル2プロジェクトにunderscore.jsライブラリを追加しようとしています。 状態で事前に404角2、underscore.jsを追加できません、404が見つかりません

感謝を「http://localhost:4200/node_modules/underscore/underscore.jsをGET」私はNPMを使用して、それをインストールしている、と私はあまりにも私のindex.htmlにunderscore.jsのスクリプトタグを追加しましたが、それはまだ私のコンソールでこのエラーを示します。

* Project Folder Structure Image here *

<!doctype html> 
 
<html lang="en"> 
 

 
<head> 
 
    <meta charset="utf-8"> 
 
    <title>ProjectEx</title> 
 
    <link href="assets/stylesheets/bootstrap.css" rel="stylesheet"> 
 
    <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"> 
 

 
    <script src="node_modules/underscore/underscore.js"></script> 
 

 
    <base href="/"> 
 

 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
 
    <link rel="icon" type="image/x-icon" href="favicon.ico"> 
 
</head> 
 

 
<body> 
 
    <app-root>Loading...</app-root> 
 

 
    <script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" 
 
    crossorigin="anonymous"></script> 
 
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> 
 
</body> 
 

 
</html>

答えて

0

あなたは角度-CLIを使用している場合は、.angular-cli.jsonに含める必要があります。 node_modulesフォルダーはビルドで使用できません。

scripts: [ 
'../node_modules/underscore/underscore.js' 
] 
+0

はい私のプロジェクトには.angular-cli.jsonファイルがありますが、私は既にスクリプトに追加していますが、まだ動作していません。 – PR7

+0

index.htmlに含める必要はありません。それはコードで利用できるはずです。どのようにそれが利用可能でないことを知っています – Skeptor

+0

私は問題がindex.htmlにあったと思ったが、ページ区切りコンポーネントhtmlファイルの問題を発見した。とにかくスケルトンに感謝します。 – PR7

関連する問題