【问题标题】:Why does my localhost:3000 not work (error 500)为什么我的 localhost:3000 不起作用(错误 500)
【发布时间】:2022-01-01 15:46:05
【问题描述】:

我正在尝试按照教程进行操作,但我什至在编写一行代码之前就遇到了问题。只有终端命令如下所示:

        *PS C:\Users\ruben\OneDrive\Bureaublad\dapp> cd .\client\
        PS C:\Users\ruben\OneDrive\Bureaublad\dapp\client> npm init vite@latest
        √ Project name: ... ./
        √ Select a framework: » react
        √ Select a variant: » react
        Scaffolding project in C:\Users\ruben\OneDrive\Bureaublad\dapp\client\...
        Done. Now run:
           npm install
           npm run dev
        PS C:\Users\ruben\OneDrive\Bureaublad\dapp\client> npm install
        added 76 packages, and audited 77 packages in 6s
        7 packages are looking for funding
           run `npm fund` for details
        found 0 vulnerabilities
        PS C:\Users\ruben\OneDrive\Bureaublad\dapp\client> npm run dev
        > dapp1@0.0.0 dev
        > vite
        Pre-bundling dependencies:
           react
           react-dom
           react/jsx-dev-runtime
        (this will be run only when your dependencies or config have changed)
        vite v2.7.10 dev server running at:
           > Local: http://localhost:3000/
           > Network: use `--host` to expose
           ready in 467ms.*

当我转到本地主机时,我会看到一个空白页面(在教程中它显示了视觉效果和一些文本。

当我检查页面时出现错误:


        :3000/:1 
        
                GET http://localhost:3000/ 500 (Internal Server Error)
        localhost/:1 
        
                GET http://localhost:3000/_next/static/chunks/fallback/webpack.js?ts=1641050312655 
        net::ERR_ABORTED 500 (Internal Server Error)
        localhost/:1 
        
               GET http://localhost:3000/_next/static/chunks/fallback/main.js?ts=1641050312655 
         net::ERR_ABORTED 500 (Internal Server Error)
         localhost/:1 
        
               GET http://localhost:3000/_next/static/chunks/fallback/react-refresh.js? 
       ts=1641050312655 net::ERR_ABORTED 500 (Internal Server Error)
         localhost/:1 
        
               GET http://localhost:3000/_next/static/chunks/fallback/pages/_app.js? 
       ts=1641050312655 net::ERR_ABORTED 500 (Internal Server Error)
        localhost/:1 
        
               GET http://localhost:3000/_next/static/chunks/fallback/pages/_error.js? 
       ts=1641050312655 net::ERR_ABORTED 500 (Internal Server Error)

同样的问题:

页面或脚本正在访问 navigator.userAgent、navigator.appVersion 和 navigator.platform 中的至少一个。从 Chrome 101 开始,用户代理字符串中可用的信息量将减少。 要解决此问题,请将 navigator.userAgent、navigator.appVersion 和 navigator.platform 的使用替换为特征检测、渐进增强或迁移到 navigator.userAgentData。 请注意,出于性能原因,仅显示对其中一个属性的第一次访问。 1 个来源 bubble_compiled.js:1

【问题讨论】:

    标签: javascript reactjs npm localhost vite


    【解决方案1】:

    这可能是权限问题。您正在 OneDrive 文件夹中工作。因此,OneDrive 很可能会不断监视内部文件夹中的每一个变化,并阻止其他应用程序的访问。尝试在另一个文件夹中重新启动您的项目。最好在 'C:\Users\ruben\Desktop' 中。

    【讨论】:

      【解决方案2】:

      确保您至少使用了 npm v6,我刚刚在节点 v17 上尝试过,它在 npm v7 上运行良好。 我关注的文档是here

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2015-09-04
        • 2021-09-05
        • 1970-01-01
        • 2017-08-17
        • 2016-07-29
        • 1970-01-01
        • 2010-12-01
        • 2015-02-04
        相关资源
        最近更新 更多