无法加载资源:net :: ERR_FILE_NOT_FOUND ionic错误

3

我已经安装了白名单插件,并在config.xml文件中进行了配置。

<access origin="*"/>
<allow-navigation href="*" />

但是

我遇到了错误。

Failed to load resource: net::ERR_FILE_NOT_FOUND
file:///lib/ion-autocomplete/dist/ion-autocomplete.css Failed to load   resource: net::ERR_FILE_NOT_FOUND
file:///css/ionic.app.css Failed to load resource: net::ERR_FILE_NOT_FOUND
file:///lib/ionic/js/ionic.bundle.js Failed to load resource: net::ERR_FILE_NOT_FOUND
file:///lib/ngCordova/dist/ng-cordova.min.js Failed to load resource: net::ERR_FILE_NOT_FOUND
file:///cordova.js Failed to load resource: net::ERR_FILE_NOT_FOUND
file:///lib/moment/moment.js Failed to load resource: net::ERR_FILE_NOT_FOUND
file:///lib/angular-bootstrap/ui-bootstrap-tpls.js Failed to load resource: net::ERR_FILE_NOT_FOUND
file:///lib/angular-bootstrap-calendar/dist/js/angular-bootstrap-calendar-tpls.js Failed to load resource: net::ERR_FILE_NOT_FOUND
file:///lib/x2js/xml2json.min.js Failed to load resource: net::ERR_FILE_NOT_FOUND
file:///lib/ionic-ajax-interceptor/dist/ionic-ajax-interceptor.min.js Failed to load resource: net::ERR_FILE_NOT_FOUND

在浏览器测试时一切正常,但在移动设备上测试时出现以上错误。

我已经尝试了所有可以找到的解决方案,但目前还无法解决。

谢谢

5个回答

7
尝试添加所有这些。
<access origin="*"/>
<access origin="tel:*" launch-external="yes"/>
<allow-navigation href="*"/>
<allow-navigation href="http://*/*"/>
<allow-navigation href="https://*/*"/>
<allow-navigation href="data:*"/>
<allow-intent href="*"/>
<access origin="*"/>

编辑:

针对您的config.xml文件


是的,这个问题在3年前就被回答过了,我怀疑它现在是否仍然有意义。 - Mark

4

我曾遇到同样的错误,通过以下两个简单步骤解决:

  1. ionic cordova platform remove android
  2. ionic cordova platform add android

之后只需运行命令 ionic cordova run android 就可以轻松解决问题。


这应该是被接受的答案!!! - Shurvir Mori

2
请见链接
请从您的index.html中删除<base href="/">

这不是个好主意:因为插件处于不一致状态,所以deviceready将无法触发。 - Alessandro Ornano
这个修复导致了ionicons无法工作,还有其他解决方案吗? - Kim Carlo

1

我遇到了同样的错误,在我的情况下,我的IP地址是错误的。检查一下你在代码中是否使用了IP地址。


1
在我的情况下,我只改变了index.html。
<base href="/" />

<base href="." />

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接