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

Cannot read property 'assetsPath' of null (react-native link) #18249

Closed
msageryd opened this issue Mar 7, 2018 · 12 comments
Closed

Cannot read property 'assetsPath' of null (react-native link) #18249

msageryd opened this issue Mar 7, 2018 · 12 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@msageryd
Copy link

msageryd commented Mar 7, 2018

Environment

Environment:
OS: macOS Sierra 10.12.6
Node: 8.6.0
Yarn: 1.2.1
npm: 5.3.0
Watchman: 4.9.0
Xcode: Xcode 9.2 Build version 9C40b
Android Studio: Not Found

Packages: (wanted => installed)
react: ^16.2.0 => 16.2.0
react-native: ^0.54.0 => 0.54.0

Expected Behavior

Should link all native libs.

Actual Behavior

react-native-link tells me that all libs are linked (as they are), but at the end there is a "linking assets.." that seems to go wrong.

I get Cannot read property 'assetsPath' of null

Update:
I get the same error when I try to unlink a library, i.e.:
react-native unlink react-native-vector-icons

gives me:

rnpm-install info Unlinking react-native-vector-icons ios dependency
rnpm-install info Platform 'ios' module undefined has been successfully unlinked
rnpm-install info Unlinking assets from ios project
rnpm-install info Unlinking assets from android project
rnpm-install ERR! It seems something went wrong while unlinking. Error: Cannot read property 'assetsPath' of null

Steps to Reproduce

I upgraded from RN 0.51 to 0.54 via react-native-git-upgrade. I was told there where conflicts in the project file, but I didn't find any conflicts.

The project itself does not run after upgrade to 0.54. This is as usual when I try to upgrade RN. after some tinkering it usually starts to work, but not this time. I suspect the "assetsPath" to be the problem.

@msageryd msageryd changed the title Cannot read property 'assetsPath' of null Cannot read property 'assetsPath' of null (react-native link) Mar 7, 2018
@hramos hramos added the CLI label Mar 8, 2018
@jiantongc
Copy link

Exactly the same here!

@EdwardOss
Copy link

The same, can someone know how to fix this?

@michaelsyap
Copy link

michaelsyap commented Mar 19, 2018

@msageryd I had the same issue as you however I realized that I wasn't in my react native project directory when I ran react-native link. When I went into the directory then ran react-native link everything went fine. I hope this helps!

@leonardoballand
Copy link

Same here! :(

@thejchap
Copy link
Contributor

thejchap commented Apr 2, 2018

In my case I'm developing an iOS only project in a subdirectory /ios. When I ran react-native link the CLI was trying to also link to a nonexistent Android project in /android. Quick fix for me was adding that folder and some of the basic Android config files it was looking for starting with android/src/main/AndroidManifest.xml: https://developer.android.com/guide/topics/manifest/manifest-intro.html.

Also opened a PR with fix: #18660

thejchap added a commit to thejchap/react-native that referenced this issue Apr 2, 2018
thejchap added a commit to thejchap/react-native that referenced this issue Apr 2, 2018
@stale
Copy link

stale bot commented Jul 1, 2018

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "For Discussion" or "Good first issue" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Jul 1, 2018
@pallyoung
Copy link

u need to add the assert youself. i also meet the problem, i just drag the asset to the xcode, and its works ok.

@stale stale bot removed the Stale There has been a lack of activity on this issue and it may be closed soon. label Jul 2, 2018
@ali-pourzahmatkesh
Copy link

Same !

kelset pushed a commit that referenced this issue Aug 13, 2018
Summary:
Fixes #18249

This PR fixes an error that occurs when running `react-native link` in projects laid out as described on the React Native website section on integrating with existing apps (https://facebook.github.io/react-native/docs/integration-with-existing-apps.html) where an `ios/` subdirectory exists but an `android/` subdirectory does not exist

<img width="1050" alt="screenshot 2018-04-02 14 57 27" src="https://user-images.githubusercontent.com/2475286/38210733-3f4bd9ea-3686-11e8-9bd3-d299812a015c.png">

None

[CLI] [BUGFIX] [local-cli/core/android/index.js] - Allow for undefined userConfig
Pull Request resolved: #18660

Differential Revision: D9235171

Pulled By: hramos

fbshipit-source-id: 230dd54f8911046f7e01633f99c4f02070fa0172
@wzup
Copy link

wzup commented Aug 15, 2018

Can anyone from React Native team give solution to the issue.
I have same error when I try to install OpenTok

$ react-native link opentok-react-native
Scanning folders for symlinks in /user/app/node_modules (34ms)
rnpm-install info Platform 'ios' module opentok-react-native is already linked 
rnpm-install info Linking assets to ios project 
rnpm-install info Linking assets to android project 
rnpm-install ERR! Something went wrong while linking. Error: Cannot read property 'assetsPath' of null 
Please file an issue here: https://github.com/facebook/react-native/issues 

Cannot read property 'assetsPath' of null

@jtan4nih
Copy link

I had some missing Android files, checkout from the git again helps. Just did a git checkout android and it works. Thanks for the tips!

@GreenRidingHood
Copy link

any solution???

@jefflombard
Copy link

This happened to me when I deleted the android folder. If you have deleted your ios or android and want to avoid this error, either pull that folder from a previous commit or follow this: https://stackoverflow.com/questions/43214862/how-to-rebuild-the-entire-android-folder

@facebook facebook locked as resolved and limited conversation to collaborators Aug 9, 2019
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Aug 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

Successfully merging a pull request may close this issue.