简体   繁体   English

无法通过离子服务在本地主机中提供ionic3应用程序(空白页)

[英]Cannot serve ionic3 app in localhost with ionic serve (blank page)

屏幕截图

hi guys i was working on a app for 2 months, its never been before. 嗨,大家好,我在一个应用程序上工作了2个月,以前从未有过。 today i typed ionic serve and it gave me a blank page. 今天,我打了离子发球,这让我空白了。 i tried again again again; 我再次尝试了一次; nothing changed. 没有改变。

the errors of console is like that: 控制台的错误是这样的:

```
Failed to load resource: the server responded with a status of 404 (Not Found)
vendor.js Failed to load resource: the server responded with a status of 404 (Not Found)
main.js Failed to load resource: the server responded with a status of 404 (Not Found)
vendor.js Failed to load resource: the server responded with a status of 404 (Not Found)
main.js Failed to load resource: the server responded with a status of 404 (Not Found)
main.css Failed to load resource: the server responded with a status of 404 (Not Found)
```

then i searched for solution on the internet and tried that: 然后我在互联网上搜索解决方案并尝试了以下操作:

```
npm uninstall -g cordova ionic
npm install -g cordova ionic
```

but it didnt work! 但是没有用!

so i remembered, once i backed up my app folder before. 所以我记得,曾经备份过我的应用文件夹。 so i tried that and saw it works. 所以我尝试了一下,看到了它的效果。 i copied that back-up folder's www/build folder files to the my up to date app-folder. 我将备份文件夹的www / build文件夹文件复制到了我最新的应用程序文件夹中。 and run ionic serve again. 并再次运行离子服务。 it deletes all files automatically and doesnt work? 它会自动删除所有文件,不起作用吗?

i cannot serve my app ? 我无法提供我的应用程序? please assist me guys. 请帮助我。 i did nothing to receive that error i am shocked! 我什么也没收到,我很震惊!

terminal: 终奌站:

```
Starting app-scripts server: --address 0.0.0.0 --port 8100 --livereload-port 35729 --dev-logger-port 53703 --nobrowser -
Ctrl+C to cancel
[04:35:39]  watch started ...
[04:35:39]  build dev started ...
[04:35:39]  clean started ...
[04:35:39]  clean finished in 7 ms
[04:35:39]  copy started ...
[04:35:39]  deeplinks started ...
[04:35:39]  deeplinks finished in 236 ms
[04:35:39]  transpile started ...
[04:35:43]  dev server running: http://localhost:8100/

[OK] Development server running!
     Local: http://localhost:8100
     External: http://192.168.1.3:8100, http://192.168.136.1:8100, http://192.168.80.1:8100
     DevApp: DenemeApp@8100 on ASUS

[04:35:44]  copy finished in 4.77 s
[04:35:44]  watch ready in 4.94 s

``` ```

stops here. 在这里停止。

my ionic info: 我的离子信息:

```

cli packages: (C:\Users\Uğur\AppData\Roaming\npm\node_modules)

    @ionic/cli-utils  : 1.19.0
    ionic (Ionic CLI) : 3.19.0

global packages:

    cordova (Cordova CLI) : 7.1.0

local packages:

    @ionic/app-scripts : 3.0.1
    Cordova Platforms  : none
    Ionic Framework    : ionic-angular 3.8.0

System:

    Node : v6.11.4
    npm  : 3.10.10
    OS   : Windows 8.1

Environment Variables:

    ANDROID_HOME : not set

Misc:

    backend : pro
```

Try serving your application in port 8102. I don't know how you managed it. 尝试在端口8102中提供应用程序。我不知道您如何管理它。 But you changed the port where your build is available. 但是您更改了可用于构建的端口。 So run the following command : 因此,运行以下命令:

$ ionic serve --p 8102

I couldnt find the solution, luckily i backed up the project lately. 我找不到解决方案,幸运的是我最近备份了该项目。 I dont know what i did to main folder but my backup folder working well. 我不知道我对主文件夹做了什么,但是我的备份文件夹运行良好。 I did exact same changes (updated) and its working. 我做了完全相同的更改(更新)及其工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM