2017-03-15 32 views
0

Heroku構建併成功部署。然而,當我嘗試打開使用所提供的應用程序,它顯示在瀏覽器這個錯誤ngMaterial無法在heroku上加載,但在本地機器上工作

Error: [$injector:modulerr] Failed to instantiate module myApp due to:

" Module 'ngMaterial' is not available!

什麼是迷惑我,這是本地一切運行良好,沒有任何錯誤。我沒有加載使用--save的角材料模塊,並列入

{ 
 
    "name": "MyApp", 
 
    "version": "0.0.0", 
 
    "dependencies": { 
 
    "angular-animate": "~1.5.3", 
 
    "angular-ui-router": "~0.2.15", 
 
    "bootstrap-sass": "~3.3.5", 
 
    "angular-bootstrap": "~1.3.3", 
 
    "malarkey": "yuanqing/malarkey#~1.3.1", 
 
    "angular-toastr": "~1.5.0", 
 
    "moment": "~2.10.6", 
 
    "animate.css": "~3.4.0", 
 
    "angular": "~1.5.3", 
 
    "angular-material": "^1.1.3", 
 
    "angular-spinners": "^3.1.2", 
 
    "ang-accordion": "*", 
 
    "angular-material-data-table": "^0.10.10", 
 
    "jquery": "^3.1.1", 
 
    "angular-cookies": "v1.5.11", 
 
    "angular-aria": "1.5.10", 
 
    "angular-messages": "^1.6.3" 
 
    }, 
 
    "devDependencies": { 
 
    "angular-mocks": "~1.5.3" 
 
    }, 
 
    "overrides": { 
 
    "bootstrap-sass": { 
 
     "main": [ 
 
     "assets/stylesheets/_bootstrap.scss", 
 
     "assets/fonts/bootstrap/glyphicons-halflings-regular.eot", 
 
     "assets/fonts/bootstrap/glyphicons-halflings-regular.svg", 
 
     "assets/fonts/bootstrap/glyphicons-halflings-regular.ttf", 
 
     "assets/fonts/bootstrap/glyphicons-halflings-regular.woff", 
 
     "assets/fonts/bootstrap/glyphicons-halflings-regular.woff2" 
 
     ] 
 
    } 
 
    }, 
 
    "resolutions": { 
 
    "angular": "~1.5.3" 
 
    } 
 
}

必要的劇本我一直在尋找過去2天的解決方案,但沒有什麼似乎爲我工作。我附上了我的bower.jsonmyApp模塊和index.html的片段。

angular.module('MyApp', ['ngAnimate','ui.router', 'ui.bootstrap', 'toastr','ngMaterial','ngAria']) 
 
    .constant('malarkey', malarkey) 
 
    .constant('moment', moment) 
 
    .config(config) 
 
    .config(routerConfig);
<!doctype html> 
 
<html ng-app="myApp" ng-strict-di> 
 

 
<head> 
 
    <meta charset="utf-8"> 
 
    <title>My</title> 
 
    <meta name="description" content=""> 
 
    <meta name="viewport" content="width=device-width"> 
 
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"/> 
 
    <link rel="stylesheet" href="./bower_components/animate.css/animations.css" /> 
 
    <link rel="stylesheet" href="./bower_components/angular-material/angular-material.css" /> 
 
    
 

 
    <!-- Place favicon.ico and apple-touch-icon.png in the root directory --> 
 

 
    <!-- build:css({.tmp/serve,src}) styles/vendor.css --> 
 
    <!-- bower:css --> 
 
    <!-- run `gulp inject` to automatically populate bower styles dependencies --> 
 
    <!-- endbower --> 
 
    <!-- endbuild --> 
 

 
    <!-- build:css({.tmp/serve,src}) styles/app.css --> 
 
    <!-- inject:css --> 
 
    <!-- css files will be automatically insert here --> 
 
    <!-- endinject --> 
 
    <!-- endbuild --> 
 

 
</head> 
 

 
<body> 
 
    <!--[if lt IE 10]> 
 
     <p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> 
 
    <![endif]--> 
 

 
    <acme-navbar></acme-navbar> 
 

 
    <div ui-view> 
 
    </div> 
 

 
    <!-- build:js(src) scripts/vendor.js --> 
 
    <!-- bower:js --> 
 
    <!-- run `gulp inject` to automatically populate bower script dependencies --> 
 
    <!-- endbower --> 
 
    <!-- endbuild --> 
 

 
    <!-- build:js({.tmp/serve,.tmp/partials}) scripts/app.js --> 
 
    <!-- inject:js --> 
 
    <!-- js files will be automatically insert here --> 
 
    <!-- endinject --> 
 

 
    <!-- inject:partials --> 
 
    <!-- angular templates will be automatically converted in js and inserted here --> 
 
    <!-- endinject --> 
 
    <!-- endbuild --> 
 

 

 
</body> 
 
<acme-footer></acme-footer> 
 
<script type="text/javascript" src="http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.6.0.js"></script> 
 
<!-- Used for JavaScript animations (include this before angular.js) --> 
 
<script src="./bower_components/jquery/dist/jquery.js"></script> 
 
<!-- Adds animation support in AngularJS --> 
 
<script src="./bower_components/angular-animate/angular-animate.js"></script> 
 
<!-- AngularJS Material Javascript now available via Google CDN; version 1.0.7 used here --> 
 

 

 
<script src="./bower_components/angular-material/angular-material.js"></script> 
 
<script src="./bower_components/angular-cookies/angular-cookies.js"></script> 
 
</html>

如何解決我的問題有什麼建議?

+0

我複製你的項目,並刪除您node_modules文件夾和「故宮安裝」,看看您是否遇到任何錯誤。你是否需要'建造'物質? –

+0

@科迪G。感謝迅速回復的人。我沒有刪除我的node_modules和bower_components文件夾並運行'npm install',但似乎沒有解決任何問題。 –

回答

0

經過長時間的故障,我終於得到了什麼問題。它是ngMaterial所依賴的依賴關係的不兼容版本。在降級ngMassages之後,一切正常。謝謝。

{ 
 
    "name": "MyApp", 
 
    "version": "0.0.0", 
 
    "dependencies": { 
 
    "angular-animate": "~1.5.3", 
 
    "angular-ui-router": "~0.2.15", 
 
    "bootstrap-sass": "~3.3.5", 
 
    "angular-bootstrap": "~1.3.3", 
 
    "malarkey": "yuanqing/malarkey#~1.3.1", 
 
    "angular-toastr": "~1.5.0", 
 
    "moment": "~2.10.6", 
 
    "animate.css": "~3.4.0", 
 
    "angular": "~1.5.3", 
 
    "angular-material": "^1.1.3", 
 
    "angular-spinners": "^3.1.2", 
 
    "ang-accordion": "*", 
 
    "angular-material-data-table": "^0.10.10", 
 
    "jquery": "^3.1.1", 
 
    "angular-cookies": "v1.5.11", 
 
    "angular-aria": "1.5.10", 
 
    "angular-messages": "^1.6.3" 
 
    }, 
 
    "devDependencies": { 
 
    "angular-mocks": "~1.5.3" 
 
    }, 
 
    "overrides": { 
 
    "bootstrap-sass": { 
 
     "main": [ 
 
     "assets/stylesheets/_bootstrap.scss", 
 
     "assets/fonts/bootstrap/glyphicons-halflings-regular.eot", 
 
     "assets/fonts/bootstrap/glyphicons-halflings-regular.svg", 
 
     "assets/fonts/bootstrap/glyphicons-halflings-regular.ttf", 
 
     "assets/fonts/bootstrap/glyphicons-halflings-regular.woff", 
 
     "assets/fonts/bootstrap/glyphicons-halflings-regular.woff2" 
 
     ] 
 
    } 
 
    }, 
 
    "resolutions": { 
 
    "angular": "~1.5.3" 
 
    } 
 
}

相關問題