isaacs / node-graceful-fs

fs with incremental backoff on EMFILE
ISC License
1.27k stars 148 forks source link

Problem with webpack 4 : Object prototype may only be an Object or null: undefined #222

Closed mebest100 closed 2 years ago

mebest100 commented 2 years ago

I build react on webpack 4.44.2, but when compile complete and it will report Object prototype may only be an Object or null: undefined from Browser console as follow screenshot: image image

It seems connected to graceful-fs, but I don't know how it come. Could anybody told the root cause about the errors. Thx!

atshweza commented 2 years ago

I am also facing the same issue @mebest100 any workarounds? index.tsx:366 Uncaught TypeError: Object prototype may only be an Object or null: undefined at Function.setPrototypeOf () at polyfills.js:139 at patch (polyfills.js:141) at patch (graceful-fs.js:104) at Object. (graceful-fs.js:96) at Object../node_modules/node-localstorage/node_modules/graceful-fs/graceful-fs.js (graceful-fs.js:429)

dargmuesli commented 2 years ago

See #216.

mebest100 commented 2 years ago

Yes, I solved this problem, the root cause comes from vscode, it insert useless code and cause mentioned error. Hence you just search by keywords 'from webpack' , and delete it when found, then everything is ok

Jonas Thelemann @.***> 于 2021年12月5日周日 16:29写道:

See #216 https://github.com/isaacs/node-graceful-fs/issues/216.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/isaacs/node-graceful-fs/issues/222#issuecomment-986187348, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACX7F34QVGHLJYRWXTSCI6TUPMPG3ANCNFSM5H2THYLA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

Cyrelc commented 2 years ago

Having the same issue with Laravel-mix v 6 which has this as a dependency. I read 216 but am uncertain how to identify a package which "is attempting to run in the browser but should only run on node". Any help would be greatly appreciated

Here is my dependency tree: image

Cyrelc commented 2 years ago

Another message for the next person who finds this - I don't know why the issue pointed to graceful-fs but somebody - whether VSCode or mix or a misttype on my part that autocompleted - added an import to one of my files that was causing the issue

import { find } from 'laravel-mix/src/File'

wangjia184 commented 2 years ago

I encountered the exactly same problem, the whole project can be found here

If I use the following version, everything is fine. "svelte-language-server": "^0.13.9"

If I upgrade it, gracefulFs fails with the exactly same error "svelte-language-server": "^0.14.0",

yoshixi commented 2 years ago

I am facing same issue in my nuxt project. The nuxt mode is spa.

yoshixi commented 2 years ago

version v4.2.5 or higher versions may cause this error.