skip to Main Content

I am getting this error while running the code in React Native expo with Tailwind

Android Bundling failed 25ms
error: node_modulesexpoAppEntry.js: [BABEL]: Cannot find module 'node:path'
Require stack:
C:UsersHPXipxnode_modulesnativewinddistbabelindex.js
C:UsersHPXipxnode_modulesnativewindbabel.js
C:[email protected]
C:[email protected]
C:[email protected]
C:[email protected]
C:UsersHPXipxnode_modulesmetro-transform-workersrcindex.js
C:UsersHPXipxnode_modulesmetrosrcDeltaBundlerWorker.flow.js
C:UsersHPXipxnode_modulesmetrosrcDeltaBundlerWorker.js
C:UsersHPXipxnode_modulesjest-workerbuildworkersprocessChild.js (While processing: C:UsersHPXipxnode_modulesnativewindbabel.js)

enter image description here


This is my AppEntry.js file :

import registerRootComponent from 'expo/build/launch/registerRootComponent';

import App from '../../App';

registerRootComponent(App);

This is my package.json file :

{
  "name": "ipx",
  "version": "1.0.0",
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web"
  },
  "dependencies": {
    "expo": "~47.0.3",
    "expo-status-bar": "~1.4.2",
    "nativewind": "^2.0.11",
    "react": "18.1.0",
    "react-native": "0.70.5",
    "tailwindcss": "^3.2.3"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9"
  },
  "private": true
}

Please replay if you have a solution for this

2

Answers


  1. You cannot use TailWind CSS with react native directly, as styling for HTML and ReactNative is different, instead you can use some library like twrnc

    Login or Signup to reply.
  2. When you installed NativeWind there was an error in your console that your version of Node does not match the minimal requirements. You need to update to >=14.18

      // from the NativeWind package.json
      "engines": {
        "node": ">=14.18"
      },
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search