我无法显示我网站的页面,我尝试调试未捕获的语法错误 1:从"反应"导入 { useState }



我的本地主机上没有显示我的网站上的页面。我不明白为什么。

主页正确显示:

我收到了的索引

但当我点击出售数字资产时,它不起作用。。。没有显示任何内容,我们只有标题:

只是标题类似于主页

当我在create-item.js(我想要显示的页面的文件(上进行调试时,它会给我以下信息:

/usr/local/bin/node ./pages/create-item.js
Process exited with code 1
Uncaught SyntaxError ...(personal information)/pages/create-item.js:1
import { useState } from 'react'
^^^^^^
SyntaxError: Cannot use import statement outside a module
at compileFunction (node:vm:352:18)
at wrapSafe (node:internal/modules/cjs/loader:1032:15)
at Module._compile (node:internal/modules/cjs/loader:1067:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
at Module.load (node:internal/modules/cjs/loader:981:32)

有人有主意吗?谢谢

谨致问候,最大

添加到您的软件包.json:

"type": "module"

最新更新