0

I'm working on my reactapp on localhost.

I received this error message during the compilation of my app on localhost. 'Module not found: Error: Can't resolve 'fs' in '-/project/reactapp/node_modules/sass'.'

My webpack version is >5.

2
  • Node v5? That's extremely old. It's not a good idea to directly edit the package.json of dependencies as they'll get overwritten eventually. Commented Feb 11, 2022 at 21:48
  • Sorry it's about webpack version. What's your solution? Commented Feb 11, 2022 at 22:05

1 Answer 1

9

I succeed to manage this error by opening the package.json file inside of the 'sass' folder that is in 'node_modules' folder that is in the root user folder (and not in the app folder) for Mac copy paste the following path with your own username file:///Users//node_modules/sass/package.json

and add the following code:

"browser": {
   "fs": false
}

And do the same in the 'node_modules/sass' that is inside of your reactapp folder : /Users/username/projectname/reactappname/node_modules/sass/package.json

And that's it.

Sign up to request clarification or add additional context in comments.

1 Comment

This works good job @KHOUIEL Salah, but I would love to know why is this a problem from the creators. If anybody has such a resource, reply here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.