Ionic服务稍后再试[无法加载index.html]

时间:2018-08-19 13:51:06

标签: ionic-framework

我已经安装了ionic和cordova,但是当我创建一个应用程序并尝试运行它时,我在终端中得到了它-

ionic-app-scripts serve --address 0.0.0.0 --port 8100 --livereload-port 35729 --dev-logger-port 53703 --nobrowser
[app-scripts] [19:17:47]  ionic-app-scripts 3.1.11 
[app-scripts] [19:17:47]  watch started ... 
[app-scripts] [19:17:47]  build dev started ... 
[app-scripts] [19:17:47]  clean started ... 
[app-scripts] [19:17:47]  clean finished in 3 ms 
[app-scripts] [19:17:47]  copy started ... 
[app-scripts] [19:17:47]  deeplinks started ... 
[app-scripts] [19:17:47]  copy finished in 13 ms 
[app-scripts] [19:17:47]  deeplinks finished in 14 ms 
[app-scripts] [19:17:47]  transpile started ... 
[app-scripts] [19:17:52]  transpile finished in 5.34 s 
[app-scripts] [19:17:52]  preprocess started ... 
[app-scripts] [19:17:52]  preprocess finished in less than 1 ms 
[app-scripts] [19:17:52]  webpack started ... 
[app-scripts] [19:17:58]  webpack finished in 6.42 s 
[app-scripts] [19:17:58]  sass started ... 
[app-scripts] Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.
[app-scripts] [19:18:00]  sass finished in 1.36 s 
[app-scripts] [19:18:00]  postprocess started ... 

[INFO] Development server running!

       Local: http://localhost:8100
       External: http://192.168.0.9:8100
       DevApp: TestApp@8100 on heath

       Use Ctrl+C to quit this process

[INFO] Browser window opened to http://localhost:8100!

[app-scripts] [19:18:00]  watch ready in 13.45 s 
[app-scripts] [19:18:01]  Failed to load index.html 

,在浏览器中,我得到“稍后重试”。 我该如何解决?

3 个答案:

答案 0 :(得分:4)

在使用以下规格的系统上,我遇到了相同的错误:

$ ionic info
✔ Gathering environment info - done!
[WARN] You are not in an Ionic project directory. Project context may be missing.

Ionic:

   ionic (Ionic CLI) : 4.1.2

System:

   NodeJS : v8.11.4
   npm    : 5.6.0
   OS     : macOS High Sierra

我通过在项目文件夹中运行以下命令来解决该问题:

npm install

答案 1 :(得分:0)

有时可能是由于对诸如index.html之类的源文件的写权限不足而发生的

要在Linux中解决此问题,您可以采用以下两种方法中的任何一种。

1:使用超级用户权限运行 ionic serve 命令。    即使用 sudo离子服务代替离子服务

2:更改项目文件夹的权限(向所有用户添加写权限)。这可以通过使用 chmod 命令->来完成 sudo chmod a + w name_of_project_folder

答案 2 :(得分:0)

npm更新对我有用-Windows 10