最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Module build failed (from .node_modulessource-map-loaderdistcjs.js) - Stack Overflow

programmeradmin4浏览0评论

I'm trying to make an emerce website with React. And it was working perfectly but after I install redux and react-redux, I'm getting this error:

Uncaught Error: Module build failed (from ./node_modules/source-map-loader/dist/cjs.js):
Error: ENOENT: no such file or directory, open 'D:\ProgrammingHero\foodie\client\node_modules\core-js-pure\modules\esnext.global-this.js'
    at ./node_modules/core-js-pure/modules/esnext.global-this.js (global-this.js:6:1)
    at options.factory (startup:7:1)
    at __webpack_require__ (jsonp chunk loading:133:1)
    at fn (jsonp chunk loading:367:1)
    at ./node_modules/core-js-pure/full/global-this.js (global-this.js:2:1)
    at options.factory (startup:7:1)
    at __webpack_require__ (jsonp chunk loading:133:1)
    at fn (jsonp chunk loading:367:1)
    at ./node_modules/core-js-pure/features/global-this.js (global-this.js:1:1)
    at options.factory (startup:7:1)

But if I uninstall redux and react-redux it works perfectly.

I'm trying to make an emerce website with React. And it was working perfectly but after I install redux and react-redux, I'm getting this error:

Uncaught Error: Module build failed (from ./node_modules/source-map-loader/dist/cjs.js):
Error: ENOENT: no such file or directory, open 'D:\ProgrammingHero\foodie\client\node_modules\core-js-pure\modules\esnext.global-this.js'
    at ./node_modules/core-js-pure/modules/esnext.global-this.js (global-this.js:6:1)
    at options.factory (startup:7:1)
    at __webpack_require__ (jsonp chunk loading:133:1)
    at fn (jsonp chunk loading:367:1)
    at ./node_modules/core-js-pure/full/global-this.js (global-this.js:2:1)
    at options.factory (startup:7:1)
    at __webpack_require__ (jsonp chunk loading:133:1)
    at fn (jsonp chunk loading:367:1)
    at ./node_modules/core-js-pure/features/global-this.js (global-this.js:1:1)
    at options.factory (startup:7:1)

But if I uninstall redux and react-redux it works perfectly.

Share Improve this question edited Jun 4, 2022 at 16:02 Youssouf Oumar 46k16 gold badges100 silver badges104 bronze badges asked Jun 4, 2022 at 14:22 loserarifloserarif 791 gold badge1 silver badge3 bronze badges 7
  • What's your Node.js version? – Youssouf Oumar Commented Jun 4, 2022 at 14:31
  • @yousoumar My node version is v14.17.1 – loserarif Commented Jun 4, 2022 at 14:34
  • Does this answer your question? Module build failed (from ./node_modules/html-loader/dist/cjs.js): – Youssouf Oumar Commented Jun 4, 2022 at 14:38
  • No! that's not my question. – loserarif Commented Jun 4, 2022 at 14:47
  • I see. You are using npm to install the packages, right ? – Youssouf Oumar Commented Jun 4, 2022 at 14:49
 |  Show 2 more ments

6 Answers 6

Reset to default 6

Delete your node_module folder and then run

 npm i

It solves the problem for me

Hi for the future people, I think I found the solution.

Modules will have these errors when you install them while running the application. Just exit the live share and run it again you should be fine.

I was reinstall my package.json without delating node_modules and it worked:

just write this :

npm i

This error message indicates that there was a problem with the source-map-loader module while building your React app. The source-map-loader module is used to load and integrate source maps into webpack bundles, and it is typically used in development environments to improve debugging.

You are getting this error because the source-map-loader module is not installed: The source-map-loader module is not installed by default in a React app, so you need to install it manually using the npm install source-map-loader or yarn add source-map-loader mand. Once you've installed the module, you should be able to build your app without encountering this error.

  • Uninstall the corresponding library that is throwing the error. (In my case it was history library)
  • Try to install the matching versions of the required library. (Sometimes the latest version of some library won't work well with the current configs of other libraries.
  • Quit the server and re run again

With the same issue, i just quited from vs code and restarted it, followed with npm start, solved.

发布评论

评论列表(0)

  1. 暂无评论