简体   繁体   English

我无法显示我网站的页面,我尝试调试未捕获的语法错误 1: import { useState } from 'react'

[英]I cannot display a page of my website, i tried debugging Uncaught Syntax Error 1: import { useState } from 'react'

A page on my site is not showing on my localhost.我网站上的某个页面没有显示在我的本地主机上。 I do not understand why.我不明白为什么。

The Home page is displayed correctly:主页正确显示:

J'arrive bien à afficher l'index.js J'arrive bien à afficher l'index.js

but when i click Sell Digital Asset it doesn't work... Nothing is displayed, we just have the header:但是当我单击“出售数字资产”时它不起作用...没有显示任何内容,我们只有 header:

Just the header like the home page就像主页一样的header

when I do a debug on create-item.js (the file of the page i want display) it gives me this:当我在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)

Does someone have an idea?有人有想法吗? thank you谢谢你

Regards, Max问候,最大

Add to your package.json:添加到您的 package.json:

"type": "module"

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我尝试使用 map function 在 react-hooks useState 中循环我的列表数据,但我遇到了一个错误,目的未定义 - I tried to use map function for looping my list data in react-hooks useState but I stuck with an error, purposes is not defined 我的控制台显示此错误“未捕获的语法错误:无法在模块外使用导入语句(位于 bundle.js:47878:2)”。 我正在构建一个 React 应用程序 - My console shows this error "Uncaught SyntaxError: Cannot use import statement outside a module (at bundle.js:47878:2)". I am building a React app 未捕获的 TypeError:myFormRef.submit 不是函数,我试图让 React 中的文本区域使用 Enter 键提交值 - Uncaught TypeError: myFormRef.submit is not a function, I tried to make my textarea in React submit the value with the key Enter 我的 React Js 网站在我的电脑上运行完美,但是当我尝试在我的手机上运行它时,它显示无法读取未定义的属性(读取“地图”) - My React Js website is running perfectly on my pc but when I tried to run it on my phone it shows, Cannot read properties of undefined (Reading 'map') 我试图从后端显示错误但错误发生 EJS - I tried to display Error from Backend But error happens EJS 我无法完全加载PHP / XHTML页面。 我认为这是语法错误,但我找不到它 - I cannot get my PHP/XHTML page to fully load. I think it is a syntax error but I cannot find it “无法导入 useState,因为在 React 中没有 useState 导出”(Flow with React Hooks) - "Cannot import useState because there is no useState export in react" (Flow with React Hooks) 我尝试使用 skulpt 制作 python 解释器,但遇到了意外错误。 我想在我的网站上使用它 - I tried to make a python interpreter using skulpt, but ran into an unexpected error. I want to use it on my website 我应该导入 useState 和 useEffect 还是可以使用 React.useState 和 React.useEffect? - Should I import useState and useEffect or is it ok to use React.useState and React.useEffect? React 组件中的删除按钮无法从页面获取 useState - A delete button in React component cannot get the useState from page
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM