未找到角度 MINERR_ASSET 404 [英] angular MINERR_ASSET not found 404

查看:30
本文介绍了未找到角度 MINERR_ASSET 404的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到一个错误记录到控制台:

I'm getting an error logged to the console:

GET http://localhost:3000/js/lib/angular/MINERR_ASSET 404 (Not Found)     

我看到了这篇文章,它说这是没有包含 ngRoute 模块的结果,但我愿意!

I saw this post and it said it was a result of not inculding ngRoute module, but I do!

public/js/app.js:

public/js/app.js:

window.app = angular.module('mean-blog-seed', ['ngCookies', 'ngResource',     'ui.bootstrap', 'ngRoute', 'mean-blog-seed.controllers', 'mean-blog-seed.services']);

然后我有一个引用angular-route.js的玉文件:

Then I have a jade file that references angular-route.js:

script(type='text/javascript', src='js/lib/angular/angular.min.js')
script(type='text/javascript', src='js/lib/angular-route/angular-route.min.js')
script(type='text/javascript', src='js/lib/angular-cookies/angular-cookies.min.js')
script(type='text/javascript', src='js/lib/angular-resource/angular-resource.min.js')
script(type='text/javascript', src='js/lib/angular-bootstrap/ui-bootstrap-tpls.min.js')

script(src='js/app.js')
script(src='js/config.js')
script(src='js/services/global.js')
script(src='js/controllers/posts.js')
script(src='js/controllers/header.js')
script(src='js/filters.js')
script(src='js/directives.js')

存储库在这里

更新:我在 github 上发布了这个问题,并引用了这个疯狂的答案:https://github.com/angular/angular.js/issues/4675

Update: I posted the issue on github and got referenced to this crazy answer: https://github.com/angular/angular.js/issues/4675

ng-closure-runner 在编译期间运行特定角度的传递它添加了 MINERR_ASSET 的定义,该资产不包括在内任何 1.2.x 版本(唯一带有源映射的版本).但是,源映射引用 MINERR_ASSET 作为源和作为结果在请求文件时出现 404.

The ng-closure-runner runs an angular specific pass during compilation which adds a definition for MINERR_ASSET, that asset is not included with any of the 1.2.x releases (the only releases with source maps). However, the source map references MINERR_ASSET as a source and as a result there is a 404 when requesting the file.

我只是快速浏览了一些繁重的任务,而且ng-closure-runner,但我的印象是这可能是ng-closure-runner 包含 minErr.js 或一些基于生成的文件它.无论哪种方式,正确的资产都应该与其他资产一起打包源文件或 MINERR_ASSET 应从源映射中删除来源".

I've only quickly glanced at the grunt tasks and also ng-closure-runner, but I'm under the impression this is likely the ng-closure-runner included minErr.js or some file generated based on it. Either way the correct asset should be packaged with the other source files or MINERR_ASSET should be removed from the source map "sources".

推荐答案

最近我注意到在 Safari 中我遇到了同样的错误.

Recently I noticed that in Safari I was getting the same error.

"sources":["angular.js","MINERR_ASSET"]

到:

"sources":["angular.js"]

并添加了与缩小版本相关联的 angularjs 文件的非缩小版本以修复控制台错误.如果您使用的是 angularjs 的生产版本(应该是缩小版),请确保添加与库文件关联的地图,否则您可能会遇到不必要的服务器错误.

and added non minified version of angularjs files associated with minified version to fixed the console errors. If you are using production version of angularjs, which should be minified version, make sure you add map associated with the library files or you may have unwanted server errors.

这篇关于未找到角度 MINERR_ASSET 404的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆