2017-07-02 96 views
1

我再次觸發這個錯誤,上次我修復了,但不知道如何修復,但它又一次發生。ngStorage模塊僅在gulp dist中找不到:服務?

我已經安裝了ngstorage模塊時,它的發展(gulp clean serve),但是當它進入生產(gulp serve:dist),它執行好,但主要頁面是空白的,沒有錯誤控制檯projecr運行良好

Uncaught Error: [$injector:modulerr] Failed to instantiate module app due to: Error: [$injector:modulerr] Failed to instantiate module ngStorage due to: Error: [$injector:nomod] Module 'ngStorage' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument. http://errors.angularjs.org/1.5.8/ $injector/nomod?p0=ngStorage

雖然我已檢查過它的安裝問題,但有人可以建議有什麼問題以及如何解決此問題?這裏是我的bower.json

{ 
    "name": "project", 
    "version": "0.1.1", 
    "dependencies": { 
    "angular-animate": "1.5.8", 
    "angular-touch": "~1.5.0", 
    "angular-sanitize": "~1.5.0", 
    "angular-messages": "~1.5.0", 
    "angular-aria": "~1.5.0", 
    "jquery": "~2.1.4", 
    "angular-resource": "~1.5.0", 
    "angular-ui-router": "~0.2.15", 
    "bootstrap": "~3.3.6", 
    "angular-bootstrap": "~1.1.2", 
    "angular-toastr": "~2.0.0", 
    "moment": "~2.13.0", 
    "animate.css": "~3.4.0", 
    "angular": "~1.5.0", 
    "ng-table": "^1.0.0", 
    "pace": "~1.0.2", 
    "metisMenu": "~2.0.2", 
    "fontawesome": "~4.5.0", 
    "roboto-fontface": "^0.7.0", 
    "angular-ui-validate": "^1.2.2", 
    "ng-stomp": "^0.2.0", 
    "angular-scrollable-table": "^1.1.1", 
    "aws-sdk": "aws-sdk-js#^2.7.7", 
    "ng-file-upload": "^12.2.13", 
    "angular-recaptcha": "^4.0.3", 
    "ng-csv": "^0.3.6", 
    "ngstorage": "^0.3.11", 
    "intl-tel-input": "5.1.7", 
    "international-phone-number": "^0.0.16", 
    "angular-chart.js": "^1.1.1" 
    }, 
    "devDependencies": { 
    "angular-mocks": "1.5.8" 
    }, 
    "overrides": { 
    "bootstrap": { 
     "main": [ 
     "less/bootstrap.less", 
     "dist/fonts/glyphicons-halflings-regular.eot", 
     "dist/fonts/glyphicons-halflings-regular.svg", 
     "dist/fonts/glyphicons-halflings-regular.ttf", 
     "dist/fonts/glyphicons-halflings-regular.woff", 
     "dist/fonts/glyphicons-halflings-regular.woff2" 
     ] 
    }, 
    "fontawesome": { 
     "main": [ 
     "less/font-awesome.less", 
     "fonts/fontawesome-webfont.eot", 
     "fonts/fontawesome-webfont.svg", 
     "fonts/fontawesome-webfont.ttf", 
     "fonts/fontawesome-webfont.woff", 
     "fonts/fontawesome-webfont.woff2" 
     ] 
    }, 
    "roboto-fontface": { 
     "main": [ 
     "css/roboto/less/roboto-fontface.less" 
     ] 
    }, 
    "chart.js": { 
       "main": [ 
        "dist/Chart.bundle.min.js" 
       ] 
      } 
    }, 
    "resolutions": { 
    "jquery": "~2.1.4", 
    "angular": "1.5.8" 
    },  
    "description": "Project Manager On-Premise", 
    "main": "", 
    "homepage": "index.html", 
    "ignore": [ 
    "**/.*", 
    "node_modules", 
    "bower_components", 
    "test", 
    "tests" 
    ] 
} 

我覺得這是對stmop或我使用broswer同步相關的問題,這可能是原因,但不能肯定。

看到console image

回答

1

問題是會費庫,可呈現在它included--失蹤分號的一個主要的JS文件

原因:

我在我的項目中使用ng-stomp和使用bower install安裝此庫,當我運行gulp dist:serve時,它縮小了主要文件bower.json中提到的所有文件,並且它讀取了bower_components/ng-stomp/package.jso n其中主文件位置爲"main": "src/ng-stomp.js",並且該文件最後缺少分號,因此當下一個js庫(ngStorage)被縮小時,它無法識別其解析器並引發錯誤。

溶液:

覆蓋主文件通過在我的bower.json寫下面代碼覆蓋塊(添加NG-stomp.min.js這端已經分號)

"ng-stomp": { 
      "main": [ 
       "dist/ng-stmop.min.js" 
      ] 
     } 

希望它可以幫助別人