2016-05-28 8 views
2

node_modulesを別の場所に移動しようとしていますが、node_modulesが削除され、package.jsonをインストールしたい場所に移動してから実行しました私はルートnode_modules代わりに、現在のからファイルを使用するには、index.htmlファイルを更新node_modulesを別の場所に正しく移動する方法

(index):5 GET http://localhost:3000/node_modules/bootstrap/dist/css/bootstrap.min.css 
(index):9 GET http://localhost:3000/node_modules/es6-shim/es6-shim.min.js 
(index):10 GET http://localhost:3000/node_modules/systemjs/dist/system-polyfills.js 
(index):12 GET http://localhost:3000/node_modules/angular2/bundles/angular2-polyfills.js 
(index):13 GET http://localhost:3000/node_modules/systemjs/dist/system.src.js 
(index):14 GET http://localhost:3000/node_modules/rxjs/bundles/Rx.js 
(index):15 GET http://localhost:3000/node_modules/angular2/bundles/angular2.dev.js 
(index):16 GET http://localhost:3000/node_modules/angular2/bundles/http.dev.js 
(index):21 Uncaught ReferenceError: System is not defined(anonymous function) @ (index):21 

:私は望んでいたが、私はnpm start、サーバーが起動を実行した場合、今、私はエラーの多くを取得node_modulesをインストールnpm install dirのnode_modules。

私はそれを機能させるために何をする必要がありますか? index.htmlにはdifferntディレクトリにあることを

お知らせその後、node_modules

+0

[ノード\ _モジュールの場所を変更する]の複製があります(http://stackoverflow.com/questions/18974436/change-node-modules-location) –

答えて

2

ソリューションは以下の通りである:

  1. は、あなたが持っている同じディレクトリにBS-config.jsonファイルを作成します。

    package.jsonファイル
  2. は、BS-config.jsonファイルに次のJSONを入れて210

    { "サーバー":{ "baseDir": "パス/ /あなた/ベース/ディレクトリ/場所//index.html/of/your/app"、 "routes": { "/ node_modules": "/パス/に/ノード/モジュール/比較的/へ/この/ファイル" } }}

  3. 編集しpackage.jsonファイル"lite": "lite-server --c bs-config.json"

  4. 実行npm startそれは魔法のように動作します:D
+0

私はこの方法を試みましたが、私のために働いていませんでした。私はこれをやりたがっています。 'bs-config.json'ファイルのフォルダ構造とパスを共有して確認できますか?またはサンプル版をplnkr.co/edit/?p=previewで共有しますか? –

関連する問題