3
votes

I'm upgrading to expo 31 from 30. I'm getting this error:

The package at "node_modules/react-native-dotenv/index.js" attempted to import the Node standard library module "path". It failed because React Native does not include the Node standard library. Read more at https://docs.expo.io/versions/latest/introduction/faq/#can-i-use-nodejs-packages-with-expo

I'm using babel.config.js. My version of react-native is "0.57.8"

I've tried clearing my cache, updating dot-env, and changing way I use it as an import

module.exports = function(api) {
api.cache(true);
return {
      "presets": ["babel-preset-expo", "module:metro-react-native-babel-preset", "module:react-native-dotenv"],
 env: {
    development: {
    plugins: [
       '@babel/transform-react-jsx-source',
      ]
    }
   }

  };
};
2
Try clearing cache every time you change the babel.config.js file: expo start -c - sergei

2 Answers

0
votes

Maintainer here! If you are using react-native-dotenv, make sure to install it as a devDependency.

-1
votes

Have you tried installing the npm version of path module? npm install path or yarn add path