将Ionic应用程序托管到AWS S3 Bucket中 - 不工作/呈现

时间:2017-05-25 06:33:48

标签: angular redirect ionic-framework amazon-s3 routing

我使用ionic2框架创建了一个简单的应用程序,并且在本地计算机上/在一个简单的< lite-server'

后面运行良好

我想在AWS S3中部署相同内容 - 使用" 启用静态网络托管"并从移动浏览器中尝试

我跑了 - ionic build browser

这在\ MyApp \ platforms \ browser \ www。

中创建了静态网页内容

我使用了节点工具' s3-website' - https://www.npmjs.com/package/s3-website

将我的应用内容发布到S3

一切顺利,我启用了静态网络托管,获得了所有人查看的权限,但它没有呈现。

被修改 应用程序模块是否应该命名" MyApp"和s3桶名匹配?好奇?

在Chrome控制台中,我收到了这些错误

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)
/build/main.css Failed to load resource: the server responded with a status of 404 (Not Found)
device.js Failed to load resource: the server responded with a status of 404 (Not Found)
statusbar.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)
StatusBarProxy.js Failed to load resource: the server responded with a status of 404 (Not Found)
SplashScreenProxy.js Failed to load resource: the server responded with a status of 404 (Not Found)
splashscreen.js Failed to load resource: the server responded with a status of 404 (Not Found)
DeviceProxy.js Failed to load resource: the server responded with a status of 404 (Not Found)
keyboard.js Failed to load resource: the server responded with a status of 404 (Not Found)
cordova.js:1297 Uncaught Error: Module cordova-plugin-device.device does not exist.
    at addEntry (cordova.js:1297)
    at Object.exports.clobbers (cordova.js:1307)
    at onScriptLoadingComplete (cordova.js:1551)
    at HTMLScriptElement.scriptLoadedCallback (cordova.js:1584)
addEntry @ cordova.js:1297
exports.clobbers @ cordova.js:1307
onScriptLoadingComplete @ cordova.js:1551
scriptLoadedCallback @ cordova.js:1584
cordova.js:1582 [Violation] 'error' handler took 177ms
main.css Failed to load resource: the server responded with a status of 404 (Not Found)
cordova.js:1051 deviceready has not fired after 5 seconds.
cordova.js:1044 Channel not fired: onPluginsReady
cordova.js:1044 Channel not fired: onCordovaReady

enter image description here

2 个答案:

答案 0 :(得分:0)

确保在那里复制所有文件。如果可能,请安装AWS CLI并清除存储桶中的现有文件。现在,尝试aws s3 cp s3:/// --recursive。希望它能帮到你

答案 1 :(得分:0)

看起来文件丢失或文件夹结构不正确。您是否从本地计算机上测试了该站点?创建文件夹并将整个网站内容下载/复制到本地文件夹。现在启动index.html,看看会发生什么。