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

Error: Unable to resolve module `react-native/Libraries/Components/View/ViewStylePropTypes #424

Open
avinashvalluru opened this issue Feb 19, 2019 · 27 comments

Comments

@avinashvalluru
Copy link

Error: Unable to resolve module react-native/Libraries/Components/View/ViewStylePropTypes from /home/avinash/Kinre/kinreAdmin/node_modules/react-native-render-html/src/HTMLUtils.js: Module react-native/Libraries/Components/View/ViewStylePropTypes does not exist in the Haste module map

@mxvsh
Copy link

mxvsh commented Feb 21, 2019

Have you got any solution? i am also facing same issue

@marcelomachado
Copy link

I am facing the same issue after update npm.

@Drikkin
Copy link

Drikkin commented Feb 22, 2019

same here at

"react": "16.5.0",
"react-native": "^0.58.5",

@Drikkin
Copy link

Drikkin commented Feb 22, 2019

hi, i presume you guys are using expo, try matching the RN version

https://docs.expo.io/versions/latest/sdk/

hope it helps

@hlmnd
Copy link

hlmnd commented Feb 24, 2019

the same problem, try with the versions of the example of Restaurant and it worked for me:
https://github.com/shoutem/ui/blob/develop/examples/RestaurantsApp/package.json
"@shoutem/ui": "~0.23.0",
"react": "16.0.0",
"react-native": "~0.51.0",

@margaridaDinis
Copy link

I have a similar problem with a freshly generated app with react-native-cli
"react": "16.6.3",
"react-native": "0.58.6"

Unable to resolve module react-native/Libraries/StyleSheet/ColorPropType.js from [path of my project]/node_modules/react-native-linear-gradient/index.ios.js: Module react-native/Libraries/StyleSheet/ColorPropType.js does not exist in the Haste module map

Is there any solution or prediction for this fix? I would really like to use Shoutem, but I'm not willing to downgrade versions to do it...

@hlmnd
Copy link

hlmnd commented Mar 3, 2019

Some things broke with versions >= 0.58.x.
The most recent version with which I worked is:
"react-native": " 0.57.8"

@riyga25
Copy link

riyga25 commented Mar 8, 2019

It is problem with react-native-linear-gradient.

But shoutem must update react-native-render-html too for "^4.1.1" ver., now there "3.10.0" and there is the same problem with proptypes as react-native-linear-gradient.

Solution for me - using react-native <0.58

@vko-online
Copy link

vko-online commented Mar 11, 2019

Im using this script unless guys fix it

fix.sh file

cp ./node_modules/react-native/Libraries/DeprecatedPropTypes/DeprecatedViewStylePropTypes.js ./node_modules/react-native/Libraries/Components/View/ViewStylePropTypes.js
cp ./node_modules/react-native/Libraries/DeprecatedPropTypes/DeprecatedColorPropType.js ./node_modules/react-native/Libraries/StyleSheet/ColorPropType.js
cp ./node_modules/react-native/Libraries/DeprecatedPropTypes/DeprecatedImageStylePropTypes.js ./node_modules/react-native/Libraries/Image/ImageStylePropTypes.js

and in package.json

{
  "scripts": {
    "postinstall": "sh ./fix.sh"
  },
  "dependencies": {
    "@shoutem/ui": "^0.23.12",
    "react": "16.6.3",
    "react-native": "0.58.5"
  }
}

@halaszbalazs
Copy link

Im using this script unless guys fix it

fix.sh file

cp ./node_modules/react-native/Libraries/DeprecatedPropTypes/DeprecatedViewStylePropTypes.js ./node_modules/react-native/Libraries/Components/View/ViewStylePropTypes.js
cp ./node_modules/react-native/Libraries/DeprecatedPropTypes/DeprecatedColorPropType.js ./node_modules/react-native/Libraries/StyleSheet/ColorPropType.js
cp ./node_modules/react-native/Libraries/DeprecatedPropTypes/DeprecatedImageStylePropTypes.js ./node_modules/react-native/Libraries/Image/ImageStylePropTypes.js

and in package.json

{
  "scripts": {
    "postinstall": "sh ./fix.sh"
  },
  "dependencies": {
    "@shoutem/ui": "^0.23.12",
    "react": "16.6.3",
    "react-native": "0.58.5"
  }
}

Thanks! Works perfectly with

"@shoutem/ui": "^0.23.16",
"react": "16.6.3",
"react-native": "0.58.6"

@Chiragmodi1247
Copy link

Facing same issue still after adding
dependecies:
"@shoutem/ui": "^0.23.16",
"react": "16.6.3",
"react-native": "0.58.6"

@Auggysg
Copy link

Auggysg commented Apr 22, 2019

I solved this issue by manually copy and pasting missing files to the respective folders. Same solution as @vko-online except I did it manually.

copied ./node_modules/react-native/Libraries/DeprecatedPropTypes/DeprecatedViewStylePropTypes.js
and pasted it in ./node_modules/react-native/Libraries/Components/View/. Changed the name of the file to ViewStylePropTypes.js

copied ./node_modules/react-native/Libraries/DeprecatedPropTypes/DeprecatedColorPropType.js
to ./node_modules/react-native/Libraries/StyleSheet/. File name changed to ColorPropType.js

copied ./node_modules/react-native/Libraries/DeprecatedPropTypes/DeprecatedImageStylePropTypes.js to ./node_modules/react-native/Libraries/Image/. File name changed to ImageStylePropTypes.js

@styk-tv
Copy link

styk-tv commented Apr 22, 2019

@vitorverasm
Copy link

vitorverasm commented Apr 26, 2019

Using the fix mentioned by @Auggysg and @vko-online worked for me.

"@shoutem/ui": "^0.23.20",
"react": "16.8.3",
"react-native": "0.59.3",

@superphil0
Copy link

In case you want to see what works with what follow the release notes of expo i.e. sdk 32:
https://blog.expo.io/expo-sdk-v32-0-0-is-now-available-6b78f92a6c52

@davidmarinangeli
Copy link

davidmarinangeli commented Oct 21, 2019

Im using this script unless guys fix it

fix.sh file

cp ./node_modules/react-native/Libraries/DeprecatedPropTypes/DeprecatedViewStylePropTypes.js ./node_modules/react-native/Libraries/Components/View/ViewStylePropTypes.js
cp ./node_modules/react-native/Libraries/DeprecatedPropTypes/DeprecatedColorPropType.js ./node_modules/react-native/Libraries/StyleSheet/ColorPropType.js
cp ./node_modules/react-native/Libraries/DeprecatedPropTypes/DeprecatedImageStylePropTypes.js ./node_modules/react-native/Libraries/Image/ImageStylePropTypes.js

and in package.json

{
  "scripts": {
    "postinstall": "sh ./fix.sh"
  },
  "dependencies": {
    "@shoutem/ui": "^0.23.12",
    "react": "16.6.3",
    "react-native": "0.58.5"
  }
}

This fix doesn't work for me after RN 0.61.2 update. Has anyone this problem too?

"@shoutem/ui": "^0.23.12",
"react": "16.9.0",
"react-native": "0.61.2",

@HessiPard
Copy link

Im using this script unless guys fix it
fix.sh file

cp ./node_modules/react-native/Libraries/DeprecatedPropTypes/DeprecatedViewStylePropTypes.js ./node_modules/react-native/Libraries/Components/View/ViewStylePropTypes.js
cp ./node_modules/react-native/Libraries/DeprecatedPropTypes/DeprecatedColorPropType.js ./node_modules/react-native/Libraries/StyleSheet/ColorPropType.js
cp ./node_modules/react-native/Libraries/DeprecatedPropTypes/DeprecatedImageStylePropTypes.js ./node_modules/react-native/Libraries/Image/ImageStylePropTypes.js

and in package.json

{
  "scripts": {
    "postinstall": "sh ./fix.sh"
  },
  "dependencies": {
    "@shoutem/ui": "^0.23.12",
    "react": "16.6.3",
    "react-native": "0.58.5"
  }
}

This fix doesn't work for me after RN 0.61.2 update. Has anyone this problem too?

"@shoutem/ui": "^0.23.12",
"react": "16.9.0",
"react-native": "0.61.2",

me too.

@HessiPard
Copy link

HessiPard commented Oct 21, 2019

Im using this script unless guys fix it
fix.sh file

cp ./node_modules/react-native/Libraries/DeprecatedPropTypes/DeprecatedViewStylePropTypes.js ./node_modules/react-native/Libraries/Components/View/ViewStylePropTypes.js
cp ./node_modules/react-native/Libraries/DeprecatedPropTypes/DeprecatedColorPropType.js ./node_modules/react-native/Libraries/StyleSheet/ColorPropType.js
cp ./node_modules/react-native/Libraries/DeprecatedPropTypes/DeprecatedImageStylePropTypes.js ./node_modules/react-native/Libraries/Image/ImageStylePropTypes.js

and in package.json

{
  "scripts": {
    "postinstall": "sh ./fix.sh"
  },
  "dependencies": {
    "@shoutem/ui": "^0.23.12",
    "react": "16.6.3",
    "react-native": "0.58.5"
  }
}

This fix doesn't work for me after RN 0.61.2 update. Has anyone this problem too?

"@shoutem/ui": "^0.23.12",
"react": "16.9.0",
"react-native": "0.61.2",

I think we should import deprecated file itself and dont use the fix.sh script anymore.
We should import like this:
import 'react-native/Libraries/DeprecatedPropTypes/DeprecatedViewStylePropTypes.js';

@davidmarinangeli
Copy link

Im using this script unless guys fix it
fix.sh file

cp ./node_modules/react-native/Libraries/DeprecatedPropTypes/DeprecatedViewStylePropTypes.js ./node_modules/react-native/Libraries/Components/View/ViewStylePropTypes.js
cp ./node_modules/react-native/Libraries/DeprecatedPropTypes/DeprecatedColorPropType.js ./node_modules/react-native/Libraries/StyleSheet/ColorPropType.js
cp ./node_modules/react-native/Libraries/DeprecatedPropTypes/DeprecatedImageStylePropTypes.js ./node_modules/react-native/Libraries/Image/ImageStylePropTypes.js

and in package.json

{
  "scripts": {
    "postinstall": "sh ./fix.sh"
  },
  "dependencies": {
    "@shoutem/ui": "^0.23.12",
    "react": "16.6.3",
    "react-native": "0.58.5"
  }
}

This fix doesn't work for me after RN 0.61.2 update. Has anyone this problem too?
"@shoutem/ui": "^0.23.12",
"react": "16.9.0",
"react-native": "0.61.2",

I think we should import deprecated file itself and dont use the fix.sh script anymore like:
import 'react-native/Libraries/DeprecatedPropTypes/DeprecatedViewStylePropTypes.js';

Do you think we should use this method?

@HessiPard
Copy link

Im using this script unless guys fix it
fix.sh file

cp ./node_modules/react-native/Libraries/DeprecatedPropTypes/DeprecatedViewStylePropTypes.js ./node_modules/react-native/Libraries/Components/View/ViewStylePropTypes.js
cp ./node_modules/react-native/Libraries/DeprecatedPropTypes/DeprecatedColorPropType.js ./node_modules/react-native/Libraries/StyleSheet/ColorPropType.js
cp ./node_modules/react-native/Libraries/DeprecatedPropTypes/DeprecatedImageStylePropTypes.js ./node_modules/react-native/Libraries/Image/ImageStylePropTypes.js

and in package.json

{
  "scripts": {
    "postinstall": "sh ./fix.sh"
  },
  "dependencies": {
    "@shoutem/ui": "^0.23.12",
    "react": "16.6.3",
    "react-native": "0.58.5"
  }
}

This fix doesn't work for me after RN 0.61.2 update. Has anyone this problem too?
"@shoutem/ui": "^0.23.12",
"react": "16.9.0",
"react-native": "0.61.2",

I think we should import deprecated file itself and dont use the fix.sh script anymore like:
import 'react-native/Libraries/DeprecatedPropTypes/DeprecatedViewStylePropTypes.js';

Do you think we should use this method?

Method you mentioned worked with RN < 60, after this version it seems that these files are updated and inside these files other Deprecated files are imported in another way. (for example inside DeprecatedViewStylePropTypes.js the ./DeprecatedColorPropType.js file is imported and because of that it throws error that can't find this file in that folder)

@davidmarinangeli
Copy link

davidmarinangeli commented Oct 21, 2019

I'm adding them one by one as RN gives me the Unable to resolve module react-native/... error. I will update you with all the files in a bit. Thanks!!

Edit: It worked!

@tkimana
Copy link

tkimana commented Nov 11, 2019

I have been having this issue since morning and I have tried every way possible and I can't get it resolved. please let me know how I can get it fixed.

/Users/flatironschool/Folder/Practice-react-native/node_modules/react-native/Libraries/StyleSheet/processColor.js
Module not found: Can't resolve '../Utilities/Platform' in '/Users/flatironschool/Folder/Practice-react-native/node_modules/react-native/Libraries/StyleSheet'

And here is my package.json

{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject"
},
"dependencies": {
"expo": "^32.0.0",
"react": "16.8.3",
"react-dom": "16.8.3",
"react-native": "https://github.com/expo/react-native/archive/sdk-32.0.0.tar.gz",
"react-native-web": "^0.11.7"
},
"devDependencies": {
"babel-preset-expo": "^7.0.0",
"components": "^0.1.0",
"styled": "^1.0.0"
},
"private": true
}

@yehudahkay
Copy link

yehudahkay commented Dec 10, 2019

I had more luck with this in the fix.sh file:

sed -i 's/StyleSheet\/ColorPropType.js/DeprecatedPropTypes\/DeprecatedColorPropType.js/' ./node_modules/react-native-linear-gradient/index.android.js

@MayoudP
Copy link

MayoudP commented Mar 3, 2020

Any update about how to fixed it in react-native 0.60.x ?

@matteo-pennisi
Copy link

I am using Expo SDK33 and still not works

@anasbalkhadir
Copy link

anasbalkhadir commented Feb 25, 2021

Any update about how to fix it ? I got this issue when I'm trying to add react-native-web to existing react-native project.

Failed to compile ./node_modules/@react-native-community/art/lib/helpers.js Module not found: Can't resolve 'react-native/Libraries/StyleSheet/processColor' in '/home/anas/app/web/node_modules/@react-native-community/art/lib

@cayleyh
Copy link

cayleyh commented Jun 14, 2023

When using RN > 0.60, the above scripts won't work because the react internals have explicitly changed to error on accessing the legacy PropTypes.

To fix this, you can patch react-native itself, using patch-package and post-install hooks: https://stackoverflow.com/a/73135908/4821759.

Ultimately shoutem dependencies need to be updated to versions of libraries that no longer require them, or use the correct deprecated package directly.

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

No branches or pull requests