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

React项目执行npm start时出现MODULE_NOT_FOUND错误:无法找到es-abstract模块文件的原因排查

Fixing MODULE_NOT_FOUND Error for es-abstract in Create React App

Hey there, let's tackle this MODULE_NOT_FOUND error you're hitting when starting your react-authentication project. First, let's recap the error you're seeing to make sure we're on the same page:

internal/modules/cjs/loader.js:456
throw e;
^

Error: Cannot find module '/home/astraCreateDataProperty/react-authentication/node_modules/es-abstract/2020/CreateDataProperty.js'
at createEsmNotFoundErr (internal/modules/cjs/loader.js:929:15)
at finalizeEsmResolution (internal/modules/cjs/loader.js:922:15)
at resolveExports (internal/modules/cjs/loader.js:450:14)
at Function.Module._findPath (internal/modules/cjs/loader.js:490:31)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:888:27)
at Function.Module._load (internal/modules/cjs/loader.js:746:27)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:92:18)
at Object. (/home/astra*/react-authentication/node_modules/object.getownpropertydescriptors/implementation.js:3:26)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
{
code: 'MODULE_NOT_FOUND',
path: '/home/astra*/react-authentication/node_modules/es-abstract/package.json'
}

You mentioned you've already tried the standard troubleshooting steps:

  • rm -rf node_modules
  • rm -rf package-lock.json
  • npm cache clean --force
  • npm install

But the error persists—let's dive into why this is happening and how to fix it.

Why This Error Happens

The root cause here is almost always a dependency version mismatch or an incomplete installation of the es-abstract module:

  1. Version Incompatibility: The object.getownpropertydescriptors package (a transitive dependency in your project) is trying to import a file from es-abstract at the path 2020/CreateDataProperty.js, but the installed version of es-abstract doesn't have this file (or stores it at a different path). This often happens when npm resolves to a newer/older es-abstract version that clashes with the dependent package.
  2. Incomplete Installation: Network blips or permission issues can sometimes cause npm to skip downloading parts of the es-abstract module, leaving critical files missing.
  3. NPM Cache Quirks: Occasionally, npm cache clean --force doesn't fully clear corrupted cache entries, leading to the same broken module being reinstalled repeatedly.

Solutions to Try

Let's go through targeted fixes that should resolve this issue:

1. Install a Compatible Version of es-abstract

The most reliable fix is to explicitly install a version of es-abstract that includes the 2020/CreateDataProperty.js file. Version ^1.19.0 is known to work with the object.getownpropertydescriptors version triggering this error:

# Uninstall the current (broken) version
npm uninstall es-abstract

# Install the compatible version
npm install es-abstract@^1.19.0

# Try starting the app again
npm start

2. Switch to Yarn for Dependency Installation

Yarn's caching and dependency resolution system is more robust in some cases. Try replacing npm with yarn:

# Clean up existing files
rm -rf node_modules package-lock.json

# Install yarn if you don't have it
npm install -g yarn

# Install dependencies with yarn
yarn install

# Start the app
yarn start

3. Perform a Full Cache Reset

If npm's built-in cache clean didn't work, manually delete the npm cache directory to ensure no corrupted files remain:

# On Linux/macOS
rm -rf ~/.npm

# On Windows (Command Prompt)
rmdir /s %AppData%\npm-cache

# Then clean up project files and reinstall
rm -rf node_modules package-lock.json
npm install
npm start

4. Fix Directory Permissions

If you're on Linux/macOS, permission issues might prevent npm from writing all module files correctly. Reset the permissions for your project directory:

sudo chown -R $USER:$USER /home/astraCreateDataProperty/react-authentication

# Then reinstall dependencies
rm -rf node_modules package-lock.json
npm install
npm start

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.04.29 20:42:33