当我在 plesk 服务器中部署我的 Node js 应用程序时出现此错误
我不明白这个问题:
“age/Spa/SpawnEnvSetupperMain.cpp:747 ]: shellName = 'false' 检测为支持 '-l': false”
有人可以帮助我吗
对于 Angular Universal 我已经弄清楚了:
原因在于
server.ts
:文件底部的if
语句不允许函数run()
运行。基本上, moduleFilename
的值与我们本地环境中通常匹配的 fileName
不匹配。
我所做的就是删除该
if
并用以下内容替换整个块。
这不会阻止在本地计算机中以 ssr 模式 (yarn dev:ssr
) 提供应用程序。
...
function run(): void {
console.info("Starting up the Node server...");
const server = app();
const port = process.env['PORT'] || 4000;
server.listen(port);
console.info(`Node Express listening on port ${port}`);
}
// Webpack will replace 'require' with '__webpack_require__'
// '__non_webpack_require__' is a proxy to Node 'require'
// The below code is to ensure that the server is run only when not requiring the bundle.
// declare const __non_webpack_require__: NodeRequire;
// const mainModule = __non_webpack_require__.main;
// const moduleFilename = mainModule && mainModule.filename || '';
run();
我们可以在Plesk中的passenger.log中看到信息日志。
App 991867 output: 991867/T1 age/Spa/SpawnEnvSetupperMain.cpp:747: shellName = 'bash' detected as supporting '-l': true
> Normally here, it stops logging and you will see a timout error. By removing the if statement server starts and you see more logs.
App 991867 output: Starting up the Node server...
App 991867 output: Node Express listening on port 443
此外,您还可以记录
moduleFilename
并查看里面的内容以及为什么可以安全地删除具有所有这些条件的 if 语句。
Angular 开发人员不听我们的,我们必须努力奋斗,直到有人提出解决方案。