isaacs / node-graceful-fs

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

Gracefulfs suddenly doesn't work anymore #246

Closed RightFootConsulting closed 7 months ago

RightFootConsulting commented 7 months ago

I added a package to my node project and then suddenly Gracefufs causes the entire project to break. Can I repro maybe not since it's a big project but if this module only works in toy projects and breaks big projects with no explanation then that is a serious problem.

    Import trace for requested module:
    ./node_modules/webpack/lib/node/NodeEnvironmentPlugin.js
    ./node_modules/webpack/lib/index.js
    ./node_modules/next/dist/compiled/webpack/webpack.js
    ./node_modules/next/dist/build/webpack/plugins/define-env-plugin.js
    ./node_modules/next/dist/build/swc/index.js
    ./src/components/Common/BoatPages.jsx
    ./src/components/Home/BoatPicker.jsx
    ./src/components/Home/LandingPreview.jsx
       automatically enabled Fast Refresh for 1 custom loader
     ⨯ ./node_modules/graceful-fs/graceful-fs.js:1:9
    Module not found: Can't resolve 'fs'

https://nextjs.org/docs/messages/module-not-found

I upgraded to latest nextJS 14.1.0, but that didn't help.

I tried adding this to my application at the top layout.jsx layer:

import realFs from 'fs';
import gracefulFs from 'graceful-fs';

gracefulFs.gracefulify(realFs);

Still no JOY.

When I go to the actual fs module in the node_modules folder I can find this readme:

Security holding package

This package name is not currently in use, but was formerly occupied by another package. To avoid malicious use, npm is hanging on to the package name, but loosely, and we'll probably give it to you if you want it.

You may adopt this package by contacting support@npmjs.com and requesting the name.

There is no code in the module and it has the followng package.json

{
  "name": "fs",
  "version": "0.0.1-security",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/npm/security-holder.git"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "bugs": {
    "url": "https://github.com/npm/security-holder/issues"
  },
  "homepage": "https://github.com/npm/security-holder#readme"
}

Now I didn't pull this package in myself but it's someone's dependency but it has completely stopped development.

isaacs commented 7 months ago

npm rm fs

fs is a built-in module. Don't try to install it from npm.