react-native-community / cli

The React Native Community CLI - command line tools to help you build RN apps
MIT License
2.34k stars 899 forks source link

Linking fails if ios project has never been built (on Windows) #1173

Closed pke closed 1 year ago

pke commented 4 years ago

Developing on Windows does not allow one to build ios projects. Trying to link fonts yields in an unhandled exception because the CLI tries to read from a non-existing plist file from the never built ios project.

There seems to be no way to disable linking for the ios platform, or disable the ios platform in the first place.

Environment

$ npx react-native info info Fetching system and libraries information... System: OS: Windows 10 10.0.18363 CPU: (12) x64 Intel(R) Core(TM) i7-9850H CPU @ 2.60GHz Memory: 38.15 GB / 63.76 GB Binaries: Node: 13.9.0 - C:\Program Files\nodejs\node.EXE Yarn: 1.22.4 - C:\Program Files\nodejs\yarn.CMD npm: 6.13.7 - C:\Program Files\nodejs\npm.CMD Watchman: Not Found SDKs: Android SDK: Not Found IDEs: Android Studio: Version 3.6.0.0 AI-192.7142.36.36.6241897 Languages: Java: 11.0.6 - C:\Users\dude\AppData\Local\Programs\AdoptOpenJDK\bin\javac.EXE Python: Not Found npmPackages: @react-native-community/cli: Not Found react: 16.11.0 => 16.11.0 react-native: 0.62.2 => 0.62.2 npmGlobalPackages: react-native: Not Found

Description

Running with this react-native.config.js:

module.exports = {
  assets: ["./assets/fonts/"],
}
$ npx react-native link --verbose
debug Available platforms: iOS, Android
debug No package name provided, will link all possible assets.
debug Linking all assets
info Linking assets to ios project
warn Group 'Resources' does not exist in your Xcode project. We have created it automatically for you.
debug Linking asset C:\projects\app\assets\fonts\LFTEtica-Bold.otf
debug Linking asset C:\projects\app\assets\fonts\LFTEtica-Italic.otf
debug Linking asset C:\projects\app\assets\fonts\LFTEtica-Regular.otf
debug Linking asset C:\projects\app\assets\fonts\LFTEtica-Semibold.otf
debug Linking asset C:\projects\app\node_modules\react-native-vector-icons\Fonts\AntDesign.ttf
debug Linking asset C:\projects\app\node_modules\react-native-vector-icons\Fonts\Entypo.ttf
debug Linking asset C:\projects\app\node_modules\react-native-vector-icons\Fonts\EvilIcons.ttf
debug Linking asset C:\projects\app\node_modules\react-native-vector-icons\Fonts\Feather.ttf
debug Linking asset C:\projects\app\node_modules\react-native-vector-icons\Fonts\FontAwesome.ttf
debug Linking asset C:\projects\app\node_modules\react-native-vector-icons\Fonts\FontAwesome5_Brands.ttf
debug Linking asset C:\projects\app\node_modules\react-native-vector-icons\Fonts\FontAwesome5_Regular.ttf
debug Linking asset C:\projects\app\node_modules\react-native-vector-icons\Fonts\FontAwesome5_Solid.ttf
debug Linking asset C:\projects\app\node_modules\react-native-vector-icons\Fonts\Fontisto.ttf
debug Linking asset C:\projects\app\node_modules\react-native-vector-icons\Fonts\Foundation.ttf
debug Linking asset C:\projects\app\node_modules\react-native-vector-icons\Fonts\Ionicons.ttf
debug Linking asset C:\projects\app\node_modules\react-native-vector-icons\Fonts\MaterialCommunityIcons.ttf
debug Linking asset C:\projects\app\node_modules\react-native-vector-icons\Fonts\MaterialIcons.ttf
debug Linking asset C:\projects\app\node_modules\react-native-vector-icons\Fonts\Octicons.ttf
debug Linking asset C:\projects\app\node_modules\react-native-vector-icons\Fonts\SimpleLineIcons.ttf
debug Linking asset C:\projects\app\node_modules\react-native-vector-icons\Fonts\Zocial.ttf
error Linking assets failed.
TypeError: Cannot read property 'UIAppFonts' of null
    at Object.linkAssetsIOS [as copyAssets] (C:\projects\app\node_modules\@react-native-community\cli-platform-ios\build\link\copyAssets.js:89:31)
    at C:\projects\app\node_modules\@react-native-community\cli\build\commands\link\linkAssets.js:42:16
    at Array.forEach (<anonymous>)
    at linkAssets (C:\projects\app\node_modules\@react-native-community\cli\build\commands\link\linkAssets.js:33:32)
    at linkAll (C:\projects\app\node_modules\@react-native-community\cli\build\commands\link\linkAll.js:96:31)
    at Object.link [as func] (C:\projects\app\node_modules\@react-native-community\cli\build\commands\link\link.js:82:33)
    at Command.handleAction (C:\projects\app\node_modules\@react-native-community\cli\build\index.js:186:23)
    at Command.listener (C:\projects\app\node_modules\commander\index.js:315:8)
    at Command.emit (events.js:321:20)
    at Command.parseArgs (C:\projects\app\node_modules\commander\index.js:651:12)
Barendan commented 3 years ago

Got the same exact issues. Would love a solution

bikram-choudhury commented 3 years ago

I had this problem and in my case it was because I had renamed the project but forgotten to update newname in a few folders and files.

github-actions[bot] commented 1 year ago

There hasn't been any activity on this issue in the past 3 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 7 days.