How to update react-script version in react?

Viewed 60

When I type the following command to see the react script version in the terminal in react, "npm view react-script version" comes out as version 2.0.5. That's why I'm getting Can't resolve 'fs' in react-script error. I think it's related to the react script version, so I want to upgrade the react script version, but I couldn't. How can I upgrade react-scripts version. Apart from that, I did some research on the internet to solve this error, but I couldn't get any results

ERROR

Compiled with problems:X

ERROR in ./node_modules/destroy/index.js 15:17-41

Module not found: Error: Can't resolve 'fs' in 'C:\Users\enest\OneDrive\Masaüstü\reactprojects\stajreact\node_modules\destroy'

before this I was getting a lot of error for example webpack < 5 used to include polyfills for node.js core modules by default I fixed it by adding your config.overrides.js file but I couldn't resolve this fs error

config.overrides.js

const webpack = require('webpack'); 
module.exports = function override(config) { 
        const fallback = config.resolve.fallback || {}; 
        Object.assign(fallback, { 
        "crypto": require.resolve("crypto-browserify"), 
      "stream": require.resolve("stream-browserify"), 
      "assert": require.resolve("assert"), 
      "http": require.resolve("stream-http"), 
      "https": require.resolve("https-browserify"), 
      "os": require.resolve("os-browserify"), 
      "url": require.resolve("url"), 
      "zlib": require.resolve("browserify-zlib"),
     
      }) 
   config.resolve.fallback = fallback; 
   config.plugins = (config.plugins || []).concat([ 
    new webpack.ProvidePlugin({ 
        process: 'process/browser', 
      Buffer: ['buffer', 'Buffer'] 
    }) 
   ]) 
   return config; }
0 Answers
Related