You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

React入门遇GET http://127.0.0.1:8080/scripts/app.js/ net::ERR_ABORTED错误求助

How to Fix the net::ERR_ABORTED Error When Loading app.js in React

Hey there! Let's break down how to fix that annoying net::ERR_ABORTED error you're seeing when loading http://127.0.0.1:8080/scripts/app.js/ in your React starter project. Even if your app seems to work right now, this error means there's a misconfiguration in how your script is being referenced or served—let's sort it out step by step:

Common Causes & Fixes

  • Fix the trailing slash in your script path
    The error shows a trailing slash at the end (app.js/) which is almost certainly the problem. Double-check your <script> tag in index.html—it should point to the file, not a directory. Correct example:

    <script src="/scripts/app.js"></script>
    

    Avoid adding a slash at the end of app.js—that tells the server to look for a folder named app.js instead of the actual JavaScript file.

  • Verify the file exists in the right location
    Pop open your project folder and confirm there's a scripts directory containing app.js. If the file's missing, re-run your build command (like npm run build if you're using Create React App) or check if your bundler (Webpack, Parcel, etc.) is outputting files to the correct directory.

  • Double-check your local server setup
    If you're using a simple server like http-server or a custom setup, make sure you're running it from your project's root folder (where index.html and the scripts folder live). Running the server from a subdirectory can mess up path mappings.

  • Clear your browser cache
    Browsers love hanging onto old paths, even after you fix them. Do a hard refresh with Ctrl+Shift+R (or Cmd+Shift+R on Mac) to bypass cached files and load the latest version of your app.

  • Check your bundler configuration
    If you're using Webpack or another bundler, verify your output settings match the path in your HTML. For example, in webpack.config.js:

    const path = require('path');
    
    module.exports = {
      output: {
        filename: 'app.js',
        path: path.resolve(__dirname, 'scripts'),
      },
    };
    

    This ensures your bundled app.js ends up in the scripts folder your HTML is referencing.

Quick Validation Step

After making changes, open your browser's DevTools (F12), go to the Network tab, and reload the page. If the error's fixed, you'll see a 200 status next to app.js instead of the aborted error.

内容的提问来源于stack exchange,提问作者Tom Foxtrot

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 08:04:04