mde/ejs

Unable to resolve module fs in react native project

TomCorvus opened this issue · 3 comments

Hi,

I have a dependency in a React Native which need EJS and when I start my app, I have this error :

error: Error: Unable to resolve module fs from /Users/.../node_modules/ejs/lib/ejs.js: fs could not be found within the project or in these directories:
  node_modules
  ../../node_modules
  46 |
  47 |
> 48 | var fs = require('fs');
     |                   ^
  49 | var path = require('path');
  50 | var utils = require('./utils');

How to avoid this error?

Thank you

You'll need to bundle your app in a way that it stubs the fs module.

Thanks @RyanZim. Any idea to fix this?

Not a RN dev, so can't really help here; https://github.com/tradle/rn-nodeify might be useful though.