简体   繁体   English

bluemix 服务单页应用程序

[英]bluemix serve onepage application

I'm trying to deploy an example in bluemix that make use of webpack using serve for serve the one page application compiled using the following on the package.js我正在尝试在 bluemix 中部署一个示例,该示例利用 webpack using serve 为使用 package.js 上的以下内容编译的单页应用程序提供服务

"start": "serve -p 6003",

But have the following error但有以下错误

[HEALTH/0] ERR healthcheck failed: failure to make TCP connection: dial tcp 10.254.1.102:8080: getsockopt: connection refused

What I'm need to change to publish this app我需要改变什么才能发布这个应用程序

I am pushing using: cf push and my manifest looks like this:我正在推动使用: cf push并且我的清单看起来像这样:

applications: 
- path: . 
  memory: 256M 
  instances: 1 
  domain: mybluemix.net 
  name: ktest2017 
  host: ktest2017 
  disk_quota: 1024M

To run the problem I'm make the following:为了解决这个问题,我做了以下事情:

  1. Create a node application in a bluemix account在 bluemix 帐户中创建节点应用程序
  2. Donwload the base project下载基础项目
  3. Create a new vue.js cli webpack-simple app, and serve as one page application server新建一个 vue.js cli webpack-simple app,作为单页应用服务器
  4. Generate the package.json start with :生成 package.json 开头:

    "scripts": { "dev": "cross-env NODE_ENV=development webpack-dev-server --open --hot", "build": "cross-env NODE_ENV=production webpack --progress --hide-modules", "start":"serve -p 6003" }, "dependencies": { "serve": "^6.2.0", "vue": "^2.4.4", "cfenv": "^1.0.4", }, "devDependencies": { "babel-core": "^6.26.0", "babel-loader": "^7.1.2", "babel-preset-env": "^1.6.0", "cross-env": "^5.0.5", "css-loader": "^0.28.7", "file-loader": "^1.1.4", "node-sass": "^4.5.3", "sass-loader": "^6.0.6", "vue-loader": "^13.0.5", "vue-template-compiler": "^2.4.4", "webpack": "^3.6.0", "webpack-dev-server": "^2.9.1" }

  5. Run npm run build to geneate the js files运行 npm run build 生成 js 文件

  6. Run locally with npm start使用 npm start 在本地运行
  7. Trying locally and works在本地尝试并有效
  8. Uploading to bluemix with CF cli使用 CF cli 上传到 bluemix
  9. Display the error显示错误

    [HEALTH/0] ERR healthcheck failed: failure to make TCP connection: dial tcp 10.254.1.102:8080: getsockopt: connection refused [HEALTH/0] ERR 健康检查失败:无法建立 TCP 连接:拨 tcp 10.254.1.102:8080:getsockopt:连接被拒绝

Maybe need to use another library to serve the one page application with vue.js也许需要使用另一个库来使用 vue.js 为单页应用程序提供服务

Cloud Foundry decides which port your application runs on. Cloud Foundry 决定您的应用程序在哪个端口上运行。 You cannot set this yourself.你不能自己设置。 See here for more info: https://docs.cloudfoundry.org/buildpacks/node/node-tips.html#port有关更多信息,请参见此处: https : //docs.cloudfoundry.org/buildpacks/node/node-tips.html#port

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

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