expo-cli
expo-cli copied to clipboard
app.json icon location not leveraged by expo as expected
Summary
app.json icon location is not leveraged by expo as expected
Environment
expo-env-info 1.0.2 environment info: System: OS: macOS 10.15.7 Shell: 5.7.1 - /bin/zsh Binaries: Node: 14.17.0 - ~/.nvm/versions/node/v14.17.0/bin/node npm: 6.14.13 - ~/.nvm/versions/node/v14.17.0/bin/npm SDKs: iOS SDK: Platforms: iOS 13.4, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2 IDEs: Xcode: 11.4.1/11E503a - /usr/bin/xcodebuild npmPackages: expo: ^44.0.5 => 44.0.6 react: 17.0.1 => 17.0.1 react-dom: 17.0.1 => 17.0.1 react-native: 0.64.3 => 0.64.3 react-native-web: 0.17.1 => 0.17.1 npmGlobalPackages: expo-cli: 5.2.0 Expo Workflow: managed
Please specify your device/emulator/simulator platform, model and version
iPhone 8 (13.4.1)
Error output
% EXPO_DEBUG=true expo start --ios Starting project at /Users/username/PROJECT_NAME Developer tools running on http://localhost:19002
Expo Metro config:
- Bundler target: bare
- Legacy: false
- Extensions: ts, tsx, js, jsx, json
- React Native: /Users/username/PROJECT_NAME/node_modules/react-native
- Babel config: /Users/username/PROJECT_NAME/babel.config.js
- Resolver Fields: react-native, browser, main
- Exotic: false
Starting Metro Bundler Running: xcrun simctl help iOS project url: exp://192.168.1.4:19000 Running: xcrun simctl list devices --json Running: xcrun simctl list devices --json Running: xcrun simctl boot 7F1D7E9B-8526-48BA-8D74-5EB1E4F679E5 Running: xcrun simctl list devices --json Running: xcrun simctl boot 7F1D7E9B-8526-48BA-8D74-5EB1E4F679E5 Running: xcrun simctl list devices --json › Opening exp://192.168.1.4:19000 on iPhone 8 Running: xcrun simctl get_app_container 7F1D7E9B-8526-48BA-8D74-5EB1E4F679E5 host.exp.Exponent Running: xcrun simctl get_app_container 7F1D7E9B-8526-48BA-8D74-5EB1E4F679E5 host.exp.Exponent Running: xcrun simctl openurl 7F1D7E9B-8526-48BA-8D74-5EB1E4F679E5 exp://192.168.1.4:19000
Reproducible demo or steps to reproduce from a blank project
app.json specifies the below
{
"expo": {
"name": "PROJECT_NAME",
"slug": "PROJECT_NAME",
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/icon.png",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": [
"**/*"
],
"ios": {
"supportsTablet": true
},
"android": {
"adaptiveIcon": {
"foregroundImage": "./assets/adaptive-icon.png",
"backgroundColor": "#FFFFFF"
}
},
"web": {
"favicon": "./assets/favicon.png"
}
}
}
Yet running expo start --ios
started giving the below error and I am not sure why. The app does run in the iOS simulator as expected.
Error: ENOENT: no such file or directory, scandir '/Users/username/PROJECT_NAME/assets/images'
To troubleshoot, created the assets/images directory and received more details:
Logs for your project will appear below. Press Ctrl+C to exit.
Error: Asset not found: /Users/username/PROJECT_NAME/assets/images/icon.png for platform: null
at /Users/username/PROJECT_NAME/node_modules/metro/src/Assets.js:215:13
at Generator.next (<anonymous>)
at asyncGeneratorStep (/Users/username/PROJECT_NAME/node_modules/metro/src/Assets.js:75:24)
at _next (/Users/username/PROJECT_NAME/node_modules/metro/src/Assets.js:97:9)
Tried troubleshooting steps suggested on the below to no avail:
- https://github.com/expo/expo/issues/9000
- https://github.com/creativetimofficial/material-kit-react-native/issues/23
Of course, placing icon.png into the assets/images folder fixes the error although it seems like this should not be necessary when a valid path is specified in app.json.
Thanks in advance!
Your app.json
lists ./assets/XXX.png
but the error states /Users/username/PROJECT_NAME/assets/images
. Any idea where the /images
is coming from? Maybe do a string search of your repository for assets/images
?
No idea where /images is coming from. Tried searching the project repo for assets/images to no avail.
I believe this is an upstream issue coming from the Metro bundler here. Can also see in the stack trace:
at /Users/username/PROJECT_NAME/node_modules/metro/src/Assets.js:215:13
@EvanBacon Apologies, I am new to this so please forgive the question: are you saying I should open a bug on the Metro project then? Thank you in advance.
I'm unsure, the issue could be related to something else in the stack requesting http://localhost:19000/assets/assets/images/icon.png
-- perhaps running with DEBUG=*
will show the network requests, but I don't think it will show you where the network requests originated from.
I think this issue should be benign, it's unclear why you cannot launch the app in the simulator.
Thank you, @EvanBacon. The app launches no problem in the simulator.
It is just rather confounding that without /Users/username/PROJECT_NAME/assets/images/icon.png
there were errors when app.json specified an alternate location.
This issue is stale because it has been open for 60 days with no activity. If there is no activity in the next 7 days, the issue will be closed.
same here when i use pnpm,
when i use yarn , it work
This issue is stale because it has been open for 60 days with no activity. If there is no activity in the next 7 days, the issue will be closed.
This issue was closed because it has been inactive for 7 days since being marked as stale. Please open a new issue if you believe you are encountering a related problem.