简体   繁体   English

将浏览器部署到Cloud Foundry后,浏览器无法解析Node.js应用程序中的manifest.json

[英]Browser not able to parse manifest.json in Node.js application after deploying it to Cloud foundry

I have created a Node.js application with angularJS. 我已经用angularJS创建了一个Node.js应用程序。 I need to add 'Add to Homescreen' functionality to the application. 我需要向应用程序添加“添加到主屏幕”功能。 So I have added the manifest.json as below. 所以我添加了manifest.json如下。

{ "name": "TEST-APP", "short_name": "TEST-APP", "version": "0.0.0.1", "background_color": "#313131", "theme_color": "#313131", "manifest_version": 2, "icons": [ { "src": "images/Test-App.png", "sizes": "192x192", "type": "image/png" }, { "src": "images/Test-App.png", "sizes": "512x512", "type": "image/png" } ], "start_url": "http://localhost:6001/", "display": "standalone" }

While testing the application in localhost, it able to parse the manifest. 在本地主机中测试应用程序时,它能够解析清单。 But after deploying it to Cloud Foundry, i am getting the below error. 但是将其部署到Cloud Foundry之后,出现以下错误。 在此处输入图片说明 Please help me with this. 请帮我解决一下这个。

i have tried Changing the manifest.json encoding to UTF-8. 我曾尝试将manifest.json编码更改为UTF-8。

There really shouldn't be that much of a difference from running locally vs running on CF. 与在CF上本地运行和在本地运行之间确实没有太大的区别。 Here's some things you can check though... 您可以通过以下方法检查...

  • Look at the output of staging (ie the nodejs buildpack). 查看暂存的输出(即,nodejs buildpack)。 Make sure it's installing the same version of Nodejs & packages that you're using locally. 确保它安装了与本地使用的相同版本的Node.js和软件包。 The buildpack tends to default to the newest/latest versions of things. buildpack倾向于默认为事物的最新/最新版本。 If you're using an older version locally, you may see differences. 如果您在本地使用的是旧版本,则可能会看到差异。

  • Look at the actual manifest.json file that is being served up from the app when running on CF. 查看在CF上运行时从应用程序提供的实际manifest.json文件。 It is possible that it's not serving up what you expect and thus JSON cannot be parsed. 可能无法满足您的期望,因此无法解析JSON。 For example, accessing the JSON could return a 404 or a server error. 例如,访问JSON可能返回404或服务器错误。 These would not be valid JSON and thus would fail. 这些不是有效的JSON,因此将失败。 If you switch to the Network tab, you can see if there were issues & you can see the exact response data returned. 如果切换到“网络”选项卡,则可以查看是否存在问题,还可以查看返回的确切响应数据。

  • You can install the cf local plugin. 您可以安装cf local插件。 This allows you to run your app using the same buildpack that runs it on CF, but in a local Docker container. 这使您可以使用在CF上运行应用程序的同一buildpack来运行您的应用程序,但是在本地Docker容器中。 It allows you to validate the "runs locally fine" theory while using the exact same versions of software that will run your app on CF. 它使您可以在使用完全相同版本的将在CF上运行您的应用程序的软件时,验证“本地运行良好”的理论。

    https://github.com/cloudfoundry-incubator/cflocal https://github.com/cloudfoundry-incubator/cflocal

Hope that helps! 希望有帮助!

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

相关问题 托管 Cloud Foundry Node.js 应用程序 - Hosting a Cloud Foundry Node.js application 在 Cloud Foundry 应用程序启动问题上部署 node.js、gulp、bower 应用程序 - Deploying node.js, gulp, bower app on Cloud Foundry application start issue 我的 node.js Web 应用无法识别我的 manifest.json - My node.js web app don't recognize my manifest.json Node.js app,Express和Cloud Foundry - Node.js app, Express and Cloud Foundry Webpacker 在 /app/public/packs/manifest.json 中找不到 application.js,删除 node_modules 文件夹后我无法预编译资产 - Webpacker can't find application.js in /app/public/packs/manifest.json and I can't precompile assets after deleting node_modules folder Cloud Foundry node.js应用程序在iOS Safari移动版上加载缓慢 - Cloud Foundry node.js application loads slow on iOS Safari mobile 部署 Firebase 和 Node.js 应用程序导致错误:Error: Parse Error in remoteconfig.template.json: Unexpected token 'i' at 1:1 - Deploying Firebase and Node.js application results in error: Error: Parse Error in remoteconfig.template.json: Unexpected token 'i' at 1:1 带有调度程序的Node.js和Cloud Foundry中的多个实例 - Node.js with scheduler and multiple instances in Cloud Foundry 如何将我的客户端连接到云代工厂上的node.js服务器 - How to connect my client to a node.js server on cloud foundry 在Cloud Foundry Node.js上运行子进程 - Run child processes on cloud foundry node.js
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM