javascript - 用于 React 的 Plesk Obsidian NodeJS 给我错误
问题描述
我在互联网上找不到有关如何将 React 应用程序安装到 Plesk 面板的文档。
根据我找到的一些文档,我在 /httpdocs 中上传了应用程序的未发布版本。
Node.js Version : 12.18.0
Document root /httpdocs
Application mode production
Application root /httpdocs [open]
Application start file src/index.tsx [edit]
iisnode 在处理请求时遇到错误。
HRESULT: 0x2
HTTP status: 500
HTTP subStatus: 1002
HTTP reason: Internal Server Error
您收到此 HTTP 200 响应是因为 system.webServer/iisnode/@devErrorsEnabled 配置设置为“true”。
除了node.exe进程的stdout和stderr的日志,考虑使用debugging和ETW traces来进一步诊断问题。
node.exe进程生成到stderr的最后64k输出如下图所示:
Application has thrown an uncaught exception and is terminated:
C:\Inetpub\vhosts\blablabla.com\httpdocs\src\index.tsx:1
import React from "react";
^^^^^^
SyntaxError: Cannot use import statement outside a module
at wrapSafe (internal/modules/cjs/loader.js:1054:16)
at Module._compile (internal/modules/cjs/loader.js:1102:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
at Module.load (internal/modules/cjs/loader.js:986:32)
at Function.Module._load (internal/modules/cjs/loader.js:879:14)
at Module.require (internal/modules/cjs/loader.js:1026:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (C:\Program Files\iisnode\interceptor.js:210:1)
at Module._compile (internal/modules/cjs/loader.js:1138:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
解决方案
推荐阅读
- python - Selenium:检查元素是否存在于循环中,如果为真,则单击,如果不存在则继续
- asp.net-identity - 使用带有 aspnet.identity 的简单注入器
- jdbc - 如何使用 Grafana 监控 JDBC 调用和统计信息
- openssl - 如何创建自己的扩展验证证书以显示绿条?
- matlab - 在matlab中创建间隔[a,b]的线性对数对数线性分区,但匹配步骤
- node.js - req.flash() 需要会话但会话存在
- node.js - 如果 JS stacktrace 中的行号超出文件末尾是什么意思?
- javascript - 在“npm”注册表中找不到“babel-code-frame@^6.26.0”所需的包“chalk@^1.1.3”(纱线添加)
- mysql - 将 CONCAT 与 GROUP_CONCAT 一起使用
- javascript - 无法使用 Map.Keys() 函数