midwayjs / midway

🍔 A Node.js Serverless Framework for front-end/full-stack developers. Build the application for next decade. Works on AWS, Alibaba Cloud, Tencent Cloud and traditional VM/Container. Super easy integrate with React and Vue. 🌈
https://www.midwayjs.org/
MIT License
7.33k stars 571 forks source link

读取私钥失败 #1332

Closed CWaiLeung closed 2 years ago

CWaiLeung commented 2 years ago

2021-10-15 16:42:58,312 ERROR 12139 Error [unhandledRejectionError]: ENOENT: no such file or directory, open '../key/privatekey.pem' at Object.openSync (fs.js:476:3) at Object.readFileSync (fs.js:377:35) at exports.default (/home/lcwai/Public/git/XXX/src/config/config.default.ts:40:20) at EggAppWorkerLoader.loadFile (/home/lcwai/Public/git/XXX/node_modules/egg-core/lib/loader/egg_loader.js:304:13) at EggAppWorkerLoader._loadConfig (/home/lcwai/Public/git/XXX/node_modules/egg-core/lib/loader/mixin/config.js:83:25) at EggAppWorkerLoader._preloadAppConfig (/home/lcwai/Public/git/XXX/node_modules/egg-core/lib/loader/mixin/config.js:68:27) at EggAppWorkerLoader.loadConfig (/home/lcwai/Public/git/XXX/node_modules/egg-core/lib/loader/mixin/config.js:26:28) at EggAppWorkerLoader.loadConfig (/home/lcwai/Public/git/XXX/node_modules/egg/lib/loader/agent_worker_loader.js:16:11) at new EggApplication (/home/lcwai/Public/git/XXX/node_modules/egg/lib/egg.js:54:17) at new Agent (/home/lcwai/Public/git/XXX/node_modules/egg/lib/agent.js:22:5) { errno: -2, syscall: 'open', code: 'ENOENT', path: '../key/privatekey.pem' }

czy88840616 commented 2 years ago

 估计是路径不对吧,需要提供目录结构和列表。

CWaiLeung commented 2 years ago

image 帮忙看看

czy88840616 commented 2 years ago

用 path.join 拼装绝对路径,不要用相对。

CWaiLeung commented 2 years ago

谢谢,已解决