Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Expo 49] Module not found: Can't resolve 'normalize-css-color' #5772

Open
1 of 5 tasks
jansenfelipe opened this issue Jul 13, 2023 · 8 comments
Open
1 of 5 tasks

[Expo 49] Module not found: Can't resolve 'normalize-css-color' #5772

jansenfelipe opened this issue Jul 13, 2023 · 8 comments

Comments

@jansenfelipe
Copy link

jansenfelipe commented Jul 13, 2023

Description

I started a simple project with Expo 49 and installed "nativebase" normally, but when trying to open the project on the web, this error Module not found: Can't resolve 'normalize-css-color' appeared

CodeSandbox/Snack link

Snack doesn't have Expo 49

Steps to reproduce

  1. npx expo init -t expo-template-blank-typescript@49
  2. npm install native-base
  3. npx expo install react-native-svg@12.1.1 react-native-safe-area-context@3.3.2
  4. npx expo install react-native-web@~0.19.6 react-dom@18.2.0 @expo/webpack-config
  5. npx expo start
  6. Press w │ open web

image

NativeBase Version

^3.4.28

Platform

  • Android
  • CRA
  • Expo
  • iOS
  • Next

Other Platform

No response

Additional Information

No response

@qd-wl
Copy link

qd-wl commented Jul 17, 2023

npm install normalize-css-color

@r-bman
Copy link

r-bman commented Jul 18, 2023

Same issue here after upgrading react-native-web to the latest version. The issue doesn't happen on RNW v0.18.12. I'm also a little concerned about the typo in the directory name!

@elenitaex5
Copy link

elenitaex5 commented Jul 24, 2023

Same issue here trying to upgrade my repo from EXPO 48 to EXPO 49.
At least this error is found in WEB

@Yamini0
Copy link

Yamini0 commented Jul 26, 2023

Getting same error after upgrading Expo Sdk to 49.
Any solution?

@mwk24
Copy link

mwk24 commented Jul 28, 2023

I did yarn add normalize-css-colors and it works

Side note: there is a typo in native-base

node_modules/native-base/lib/commonjs/utils/react-native-web-fucntions

@elenitaex5
Copy link

elenitaex5 commented Jul 31, 2023

I did yarn add normalize-css-colors and it works

Side note: there is a typo in native-base

node_modules/native-base/lib/commonjs/utils/react-native-web-fucntions

It could be meanwhile solution, but I think install "not-used" dependencies in a project could be a fine solution for anyone...

@joaomantovani
Copy link

joaomantovani commented Aug 15, 2023

-yarn add normalize-css-colors
+yarn add normalize-css-color

A little adjust for me, the library must be is in singular instead of plural when running yarn.

@ts-candide
Copy link

ts-candide commented Sep 28, 2023

normalize-css-color was removed from RNW as of v0.19.6, to be replaced with @react-native/normalize-color. The two packages have the same API, with the latter supporting more color notations.

Regardless, the fix here should be for NativeBase to include a dependency on the package that it is using, instead of assuming that a peer dependency brings it in. In this case, my recommendation would be to add a dependency on @react-native/normalize-color within the NativeBase package.json.

In the meantime, for anyone upgrading RNW to 0.19.6 and beyond, you have two options:

  1. Add a dependency on normalize-css-color as suggested above
  2. Add an alias in your webpack configuration, so that any attempts to require or import normalize-css-color are instead satisfied with @react-native/normalize-color:
// webpack.config.js
module.exports = {
  resolve: {
    alias: {
      "react-native$": "react-native-web",
      "normalize-css-color": "@react-native/normalize-color",
      // ... any other aliases
    }
    // ... any other `resolve` config
  },
  // .. other config
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants