0

I have tried pretty much everything, but it still says 'can't resolve ffs'. I have ffs installed and everything. Here is part of my webpack.config.js, As you can see, I've already tried a lot of the solutions. I also have the same problem with the crypto, http, and './zlib_bindings' modules.

       module: {
    // configuration regarding modules
    rules: [
      // rules for modules (configure loaders, parser options, etc.)
      {
        // Conditions:
        test: /\.jsx?$/,
        include: [
          path.resolve(__dirname, "app")
        ],
        exclude: [
          path.resolve(__dirname, "app/demo-files")
        ],
        // these are matching conditions, each accepting a regular expression or string
        // test and include have the same behavior, both must be matched
        // exclude must not be matched (takes preferrence over test and include)
        // Best practices:
        // - Use RegExp only in test and for filename matching
        // - Use arrays of absolute paths in include and exclude to match the full path
        // - Try to avoid exclude and prefer include
        // Each condition can also receive an object with "and", "or" or "not" properties
        // which are an array of conditions.
        issuer: /\.css$/,
        issuer: path.resolve(__dirname, "app"),
        issuer: { and: [ /\.css$/, path.resolve(__dirname, "app") ] },
        issuer: { or: [ /\.css$/, path.resolve(__dirname, "app") ] },
        issuer: { not: [ /\.css$/ ] },
        issuer: [ /\.css$/, path.resolve(__dirname, "app") ], // like "or"
        // conditions for the issuer (the origin of the import)
        /* Advanced conditions (click to show) */

        // Actions:
        loader: "babel-loader",
        // the loader which should be applied, it'll be resolved relative to the context
        options: {
          presets: ["es2015"]
        },
        // options for the loader
        use: [
          // apply multiple loaders and options instead
          "htmllint-loader",
          {
            loader: "html-loader",
            options: {
              // ...
            }
          }
        ],
        type: "javascript/auto",
        // specifies the module type
        /* Advanced actions (click to show) */
      },
      {
        oneOf: [
          // ... (rules)
        ]
        // only use one of these nested rules
      },
      {
        // ... (conditions)
        rules: [
          // ... (rules)
        ]
        // use all of these nested rules (combine with conditions to be useful)
      },
    ],
    /* Advanced module configuration (click to show) */
  },
  
  resolve: {
    fallback: {
        "fs": false,
        "crypto": false,
        "http": require.resolve("stream-http")
        },
    // options for resolving module requests
    // (does not apply to resolving of loaders)
    
    modules: ["node_modules",path.resolve(__dirname, "app")],
    // directories where to look for modules (in order)
    extensions: [".js", ".json", ".jsx", ".css"],
    // extensions that are used
    alias: {



     // a list of module name aliases
      // aliases are imported relative to the current context
      "module": "new-module",
      // alias "module" -> "new-module" and "module/path/file" -> "new-module/path/file"
      "only-module$": "new-module",
      // alias "only-module" -> "new-module", but not "only-module/path/file" -> "new-module/path/file"
      "module": path.resolve(__dirname, "app/third/module.js"),
      // alias "module" -> "./app/third/module.js" and "module/file" results in error
      "module": path.resolve(__dirname, "app/third"),
      // alias "module" -> "./app/third" and "module/file" -> "./app/third/file"
      [path.resolve(__dirname, "app/module.js")]: path.resolve(__dirname, "app/alternative-module.js"),
      // alias "./app/module.js" -> "./app/alternative-module.js"
      
    },
    /* Alternative alias syntax (click to show) */
    /* Advanced resolve configuration (click to show) */
    /* Expert resolve configuration (click to show) */
  },

    
   

Does anyone have any suggestions on how to fix said error? Also, here are the parts my package.json file I feel that are important to the problem. :

{
 
  "name": "tsts",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.16.2",
    "@testing-library/react": "^12.1.2",
    "@testing-library/user-event": "^13.5.0",
    "buffer": "^6.0.3",
    "crypto": "^1.0.1",
    "dotenv": "^16.0.0",
    "fs": "^0.0.1-security",
    "http": "^0.0.1-security",
    "net": "^1.0.2",
    "nodemon": "^2.0.15",
    "path": "^0.12.7",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-scripts": "5.0.0",
    "stream": "^0.0.2",
    "stream-http": "^3.2.0",
    "url": "^0.11.0",
    "web-vitals": "^2.1.4",
    "zlib": "^1.0.5"
  },


  
    
  
}

EDIT: I want to stop using these modules. Do I have to ninstall them, take them out of my package.json, or what?

  • Sounds like you may have an error somewhere, have you tried completely deleting all the module directories and re-installing your modules? – BGPHiJACK Feb 08 '22 at 16:08
  • I've rarely while in development have had means like this to completely re-install my node.js/modules and it generally solves issues as you may have confused local vs global module locations/etc. – BGPHiJACK Feb 08 '22 at 16:10
  • Could you please include the entire web pack file? Also if you are using ts please include the tsconfig file. Also try and look if all of your modules are installed in the node modules dir – JohnD Feb 08 '22 at 16:10
  • 1
    The title says `fs` but your question states `ffs`. Which is it? – phuzi Feb 08 '22 at 16:15
  • The error is actually fs. ffs is a typo – DeathRay2000 Feb 08 '22 at 16:16
  • Well you cannot use `fs` / `ffs` / `http` and probably some more modules on the browser! These are `nodejs` modules and work on the serverside but do NOT work in the browser!! The browser simply does not support `filesystem` since it is `javascript` .. – Silvan Bregy Feb 08 '22 at 16:27
  • I've tried deleting then reinstalling the modules also. Didnt work – DeathRay2000 Feb 08 '22 at 16:27
  • I want to stop using these modules all together. How do I do that? – DeathRay2000 Feb 08 '22 at 16:28
  • Remove them from `package.json` by hand and run `npm install` / `yarn install` again OR us `npm remove ffs` for example. But please take your time and learn the difference between `ndoejs` and `javascript` . One is client , one is server. – Silvan Bregy Feb 08 '22 at 16:29
  • It turns out I was just being and idiot and using node modules when using a browser app – DeathRay2000 Feb 08 '22 at 17:12

0 Answers0