首页 > 解决方案 > 用于 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)

标签: javascriptnode.jsreactjswebpackplesk

解决方案


推荐阅读