klever-web icon indicating copy to clipboard operation
klever-web copied to clipboard

按照步骤构建镜像,启动报错了,本地start可以起来

Open Jesyjun opened this issue 4 years ago • 2 comments

[email protected] server /usr/src/app node app.js

/usr/src/app/node_modules/http-proxy-middleware/dist/config-factory.js:38 throw new Error(errors_1.ERRORS.ERR_CONFIG_FACTORY_TARGET_MISSING); ^

Error: [HPM] Missing "target" option. Example: {target: "http://www.example.org"} at Object.createConfig (/usr/src/app/node_modules/http-proxy-middleware/dist/config-factory.js:38:15) at new HttpProxyMiddleware (/usr/src/app/node_modules/http-proxy-middleware/dist/http-proxy-middleware.js:128:40) at createProxyMiddleware (/usr/src/app/node_modules/http-proxy-middleware/dist/index.js:6:28) at Object. (/usr/src/app/app.js:14:3) at Module._compile (internal/modules/cjs/loader.js:999:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10) at Module.load (internal/modules/cjs/loader.js:863:32) at Function.Module._load (internal/modules/cjs/loader.js:708:14) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12) at internal/main/run_main_module.js:17:47 npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] server: node app.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] server script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2020-12-24T09_56_36_529Z-debug.log

Jesyjun avatar Dec 24 '20 09:12 Jesyjun

/cc @hewenguang

judgeeeeee avatar Dec 24 '20 10:12 judgeeeeee

你好,很高兴你对我们的产品感兴趣。通过描述,我理解你是本地打得镜像直接 docker run 启动的镜像。

前端的应用,是通过 node 代理的形式去链接后端接口,这里的后端接口是通过跑起来镜像时注入的环境变量。所以会报拿不到环境变量的错误

推荐你使用我们的一键部署代码来启动应用

helm install klever-web $CWD/klever-web/manifests/klever-web
--namespace=kleveross-system
--set service.nodePort=$KLEVER_WEB_PORT
--set model.registry.address=http://$MASTER_IP:$KLEVER_MODEL_REGISTRY_PORT

脚本启动会自动注入环境变量并启动需要依赖的后端服务

hewenguang avatar Dec 24 '20 10:12 hewenguang