ui icon indicating copy to clipboard operation
ui copied to clipboard

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

Open avinashvalluru opened this issue 5 years ago • 27 comments

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

avinashvalluru avatar Feb 19 '19 10:02 avinashvalluru

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

mxvsh avatar Feb 21 '19 06:02 mxvsh

I am facing the same issue after update npm.

marcelomachado avatar Feb 22 '19 03:02 marcelomachado

same here at

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

Drikkin avatar Feb 22 '19 18:02 Drikkin

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

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

hope it helps

Drikkin avatar Feb 22 '19 19:02 Drikkin

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",

hlmnd avatar Feb 24 '19 11:02 hlmnd

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...

margaridaDinis avatar Mar 03 '19 11:03 margaridaDinis

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

hlmnd avatar Mar 03 '19 12:03 hlmnd

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

riyga25 avatar Mar 08 '19 05:03 riyga25

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"
  }
}

vko-online avatar Mar 11 '19 09:03 vko-online

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"

halaszbalazs avatar Mar 13 '19 11:03 halaszbalazs

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

Chiragmodi1247 avatar Apr 08 '19 19:04 Chiragmodi1247

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

Auggysg avatar Apr 22 '19 11:04 Auggysg

Linking: https://github.com/react-native-community/react-native-linear-gradient/issues/356

styk-tv avatar Apr 22 '19 18:04 styk-tv

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",

vitorverasm avatar Apr 26 '19 00:04 vitorverasm

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

superphil0 avatar May 06 '19 09:05 superphil0

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",

davidmarinangeli avatar Oct 21 '19 09:10 davidmarinangeli

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 avatar Oct 21 '19 10:10 HessiPard

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';

HessiPard avatar Oct 21 '19 10:10 HessiPard

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?

davidmarinangeli avatar Oct 21 '19 12:10 davidmarinangeli

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)

HessiPard avatar Oct 21 '19 12:10 HessiPard

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!

davidmarinangeli avatar Oct 21 '19 12:10 davidmarinangeli

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 }

tkimana avatar Nov 11 '19 22:11 tkimana

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

yehudahkay avatar Dec 10 '19 12:12 yehudahkay

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

MayoudP avatar Mar 03 '20 09:03 MayoudP

I am using Expo SDK33 and still not works

matteo-pennisi avatar Mar 10 '20 22:03 matteo-pennisi

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

anasbalkhadir avatar Feb 25 '21 11:02 anasbalkhadir

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.

cayleyh avatar Jun 14 '23 16:06 cayleyh