当我运行时,我的角度应用程序工作正常,grunt serve,但是它给出了
Failed to instantiate module toastr due to:Error: [$injector:nomod] Module 'toastr' is not available!
在grunt serve:dist中运行相同的错误。
现在我知道很多人都问过同样的问题,但没有一个答案能解决我的问题。
问题是,我认为问题在某种程度上涉及到我运行一些不同版本的插件。我这么说是因为我的一位同事在他的电脑里成功地编译了相同的代码。
所以得到正确的版本可能对我有帮助。这是以下外部工具和我的package.json和bower.json文件。
bower.json
{
"name": "********",
"Author": "*********",
"version": "0.0.0",
"dependencies": {
"angular": "^1.4.0",
"bootstrap": "^3.2.0",
"angular-block-ui": "^0.2.2",
"angular-cookies": "^1.4.0",
"angular-route": "^1.4.0",
"angular-sanitize": "^1.4.0",
"angular-touch": "^1.4.0",
"angular-ui-router": "^0.2.18",
"ngstorage": "^0.3.10",
"angular-toastr": "^2.1.1",
"highcharts": "^6.0.3",
"moment": "^2.19.3",
"bootstrap-timepicker": "^0.5.2",
"bootstrap-datepicker": "^1.7.1",
"daterangepicker": "^1.6.0",
"underscore": "^1.8.3",
"angular-daterangepicker": "^0.2.2",
"infinite-scroll": "^3.0.2",
"angularjs-dropdown-multiselect": "^1.11.8",
"alasql": "^0.4.4",
"angular-datatables": "0.5.4"
},
"devDependencies": {
"angular-mocks": "^1.4.0"
},
"appPath": "app",
"moduleName": "infin8",
"overrides": {
"bootstrap": {
"main": [
"dist/css/bootstrap.css",
"dist/js/bootstrap.js"
]
}
},
"resolutions": {
"angular": ">=1.4.0",
"moment": "^2.19.3",
"jquery": ">=1.7.1 <4.0.0"
}
}package.json
{
"name": "infin8",
"private": true,
"devDependencies": {
"autoprefixer-core": "^5.2.1",
"grunt": "^0.4.5",
"grunt-angular-templates": "^0.5.7",
"grunt-concurrent": "^1.0.0",
"grunt-contrib-clean": "^0.6.0",
"grunt-contrib-compass": "^1.0.0",
"grunt-contrib-concat": "^0.5.0",
"grunt-contrib-connect": "^0.9.0",
"grunt-contrib-copy": "^0.7.0",
"grunt-contrib-cssmin": "^0.12.0",
"grunt-contrib-htmlmin": "^0.4.0",
"grunt-contrib-imagemin": "^1.0.0",
"grunt-contrib-jshint": "^0.11.0",
"grunt-contrib-uglify": "^0.7.0",
"grunt-contrib-watch": "^0.6.1",
"grunt-filerev": "^2.1.2",
"grunt-google-cdn": "^0.4.3",
"grunt-jscs": "^1.8.0",
"grunt-karma": "*",
"grunt-newer": "^1.1.0",
"grunt-ng-annotate": "^0.9.2",
"grunt-postcss": "^0.5.5",
"grunt-svgmin": "^2.0.0",
"grunt-usemin": "^3.0.0",
"grunt-wiredep": "^2.0.0",
"jit-grunt": "^0.9.1",
"jshint-stylish": "^1.0.0",
"karma-jasmine": "*",
"karma-phantomjs-launcher": "*",
"time-grunt": "^1.0.0"
},
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "grunt test"
},
"dependencies": {
"angular-material-time-picker": "^1.0.7",
"autoprefixer-core": "^5.2.1",
"bower": "~1.8.0",
"compass": "^0.1.1",
"datatables.net-responsive": "^2.2.0",
"datatables.net-responsive-dt": "^2.2.0",
"grunt": "~0.4.5",
"grunt-angular-templates": "^0.5.9",
"grunt-cli": "~1.2.0",
"grunt-concurrent": "^1.0.1",
"grunt-contrib-clean": "^0.6.0",
"grunt-contrib-compass": "^1.1.1",
"grunt-contrib-concat": "^0.5.1",
"grunt-contrib-connect": "^0.9.0",
"grunt-contrib-copy": "^0.7.0",
"grunt-contrib-cssmin": "^0.12.3",
"grunt-contrib-imagemin": "^1.0.1",
"jit-grunt": "^0.9.1",
"jshint-stylish": "^1.0.2",
"time-grunt": "^1.4.0",
"wiredep": "^4.0.0"
}
}这是我的工具版本。
提前感谢
发布于 2018-02-01 12:27:28
我终于把它做对了。出于某种原因,我使用的是角版本1.5.11 (go图)。
我一直怀疑改变我的角度版本会设置正确的构建,但你知道业务规则和“使用”旧的和经过测试的框架,嗯.所以是的。
现在真让人松了一口气。
无论如何,将我的版本改为1.6.8,运行grunt :dist,获得了一些错误,但至少我得到了一些东西,这对我来说已经足够了。
.json文件来自我的同事。
编辑:仍然错误。如果我有任何突破,我会继续发帖。
https://stackoverflow.com/questions/48562090
复制相似问题