0
私はモジュールとその依存関係を作成し、インポート注文を確認して、index.html <script>
タグでjsファイルをインポートしました。
私のサーバーは、私は亭で$injector:modulerr
スタックトレースポイントを得る私のページをレンダリングしようとすると、しかし、すべての私の亭コンポーネントが存在しています。
この問題をデバッグする方法がわかりません。
私はディレクトリ構造を持っている:
app.js
hmodule/
hmodule/helpermonkeys.js
hmodule/services/monkeymessageservice.js
hmodule/controllers/monkeycontroller.js
/app.js:
var centroApp = angular.module("centroApp", ['ngRoute', ..., 'ngWebSocket', 'helpermonkeys'])
/hmodule/hm.js
(function() {
'use strict';
angular.module('helpermonkeys', ['ngWebSocket', 'monkeyMessageService', 'monkeyController']);
})();
/hmodule/services/monkeymessageservice.jsを
(function() {
'use strict';
angular.module('helpermonkeys').factory('monkeyMessageService', ['ngWebSocket', monkeyMessageService]);
function monkeyMessageService($websocket) {
var messageService = {
connect: connect,
sendActuatorRequest: sendActuatorRequest,
sendDataRequest: sendDataRequest,
sendCommandRequest: sendCommandRequest,
messages: []
}
return messageService;
...
})();
/hmmodule/controllers/monekeycontroller.js
(function() {
'use strict';
angular.module('helpermonkeys').controller('monkeyController', ['$scope', 'monkeyMessageService', monkeyController]);
....
})();
index.htmlを
<script src="/js/helpermonkeysmodule/helpermonkeys.js"></script>
<script src="/js/helpermonkeysmodule/services/monkeymessageservice.js"></script>
<script src="/js/helpermonkeysmodule/controllers/monkeycontroller.js"></script>
<script src="/js/app.js"></script>
スタックトレース
Failed to instantiate module centroApp due to:
Error: [$injector:modulerr] http://errors.angularjs.org/1.5.9/$injector/modulerr?p0=h...)
at https://localhost/bower_components/angular/angular.min.js:6:412
at https://localhost/bower_components/angular/angular.min.js:40:292
at q (https://localhost/bower_components/angular/angular.min.js:7:359)
at g (https://localhost/bower_components/angular/angular.min.js:39:382)
at https://localhost/bower_components/angular/angular.min.js:40:34
at q (https://localhost/bower_components/angular/angular.min.js:7:359)
at g (https://localhost/bower_components/angular/angular.min.js:39:382)
at eb (https://localhost/bower_components/angular/angular.min.js:43:382)
at c (https://localhost/bower_components/angular/angular.min.js:21:19)
at Ic (https://localhost/bower_components/angular/angular.min.js:21:332
エラーURL:
https://docs.angularjs.org/error/$injector/modulerr?p0=helpermonkeys&p1=Error:%20%5B$injector:modulerr%5D%20http:%2F%2Ferrors.angularjs.org%2F1.5.9%2F$injector%2Fmodulerr%3Fp0%3DmonkeyMessageService%26p1%3DError%253A%2520%255B%2524injector%253Anomod%255D%2520http%253A%252F%252Ferrors.angularjs.org%252F1.5.9%252F%2524injector%252Fnomod%253Fp0%253DmonkeyMessageService%250A%2520%2520%2520%2520at%2520https%253A%252F%252Flocalhost%252Fbower_components%252Fangular%252Fangular.min.js%253A6%253A412%250A%2520%2520%2520%2520at%2520https%253A%252F%252Flocalhost%252Fbower_components%252Fangular%252Fangular.min.js%253A25%253A235%250A%2520%2520%2520%2520at%2520b%2520(https%253A%252F%252Flocalhost%252Fbower_components%252Fangular%252Fangular.min.js%253A24%253A282)%250A%2520%2520%2520%2520at%2520https%253A%252F%252Flocalhost%252Fbower_components%252Fangular%252Fangular.min.js%253A25%253A20%250A%2520%2520%2520%2520at%2520https%253A%252F%252Flocalhost%252Fbower_components%252Fangular%252Fangular.min.js%253A40%253A17%250A%2520%2520%2520%2520at%2520q%2520(https%253A%252F%252Flocalhost%252Fbower_components%252Fangular%252Fangular.min.js%253A7%253A359)%250A%2520%2520%2520%2520at%2520g%2520(https%253A%252F%252Flocalhost%252Fbower_components%252Fangular%252Fangular.min.js%253A39%253A382)%250A%2520%2520%2520%2520at%2520https%253A%252F%252Flocalhost%252Fbower_components%252Fangular%252Fangular.min.js%253A40%253A34%250A%2520%2520%2520%2520at%2520q%2520(https%253A%252F%252Flocalhost%252Fbower_components%252Fangular%252Fangular.min.js%253A7%253A359)%250A%2520%2520%2520%2520at%2520g%2520(https%253A%252F%252Flocalhost%252Fbower_components%252Fangular%252Fangular.min.js%253A39%253A382)%0A%20%20%20%20at%20https:%2F%2Flocalhost%2Fbower_components%2Fangular%2Fangular.min.js:6:412%0A%20%20%20%20at%20https:%2F%2Flocalhost%2Fbower_components%2Fangular%2Fangular.min.js:40:292%0A%20%20%20%20at%20q%20(https:%2F%2Flocalhost%2Fbower_components%2Fangular%2Fangular.min.js:7:359)%0A%20%20%20%20at%20g%20(https:%2F%2Flocalhost%2Fbower_components%2Fangular%2Fangular.min.js:39:382)%0A%20%20%20%20at%20https:%2F%2Flocalhost%2Fbower_components%2Fangular%2Fangular.min.js:40:34%0A%20%20%20%20at%20q%20(https:%2F%2Flocalhost%2Fbower_components%2Fangular%2Fangular.min.js:7:359)%0A%20%20%20%20at%20g%20(https:%2F%2Flocalhost%2Fbower_components%2Fangular%2Fangular.min.js:39:382)%0A%20%20%20%20at%20https:%2F%2Flocalhost%2Fbower_components%2Fangular%2Fangular.min.js:40:34%0A%20%20%20%20at%20q%20(https:%2F%2Flocalhost%2Fbower_components%2Fangular%2Fangular.min.js:7:359)%0A%20%20%20%20at%20g%20(https:%2F%2Flocalhost%2Fbower_components%2Fangular%2Fangular.min.js:39:382
@charlietflのおかげでURLに違反しているファイルがあることがわかりましたので、私は自分のメッセージングサービスを調べるつもりです。
角のURLエラーリンクのスタックトレースに従って、どのモジュールが原因であるかがわかります。 –
スタックトレースは、バワー問題があることを示しています。私はスタックトレースで更新しますが、あまり有用ではありません。 – Babbleshack
モジュール名はエラーの最初の行にあり、 '...'で切り捨てます。構文エラーによっても引き起こされる可能性があります – charlietfl