我的角度应用程序在我运行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"
}
}
这些是我的工具版本。
提前致谢
答案 0 :(得分:0)
我终于做对了。出于某种原因,我使用的是角度版本1.5.11,( go figure )。
我总是怀疑改变我的角度版本会使构建正确,但你知道业务规则和“使用”旧的和经过测试的框架,嗯......所以是的。< / p>
现在真是太宽慰了。
无论如何,将我的版本更改为1.6.8,运行 grunt serve:dist ,获取登录页面以及一些错误但 atatast 我得到的东西,这不仅仅是对我来说足够了。
P.S。 .json文件来自我的同事。
修改强> 还是错误。如果我取得任何突破,我会继续发帖。