Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Can't require image with spaces, etc. in filename

Open
#1,609 2 comments 1 reaction 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
42/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
javascript, react-native

Research direction

Start in metro/src/Assets.js at getAbsoluteAssetRecord and getAsset, using the reported stack trace as the entry point. Reproduce the asset request with a filename containing spaces under React Native 0.81 and compare behavior with 0.79. Done means the asset loads without the ENOENT path containing encoded filename characters.

Written by the indexing model from the issue text.

Description

Hi folks, I'm getting the same error seen in this very old RN issue:

https://github.com/facebook/react-native/issues/10364

Here is the stacktrace that shows this is ocurring in Assets.js

Error: ENOENT: no such file or directory, scandir '/Users/andrew/Work/Code/projects/Failure/Mobile/ReactNative/failure/.%2Fassets%2Fimages'
    at Object.readdir (node:internal/fs/promises:956:18)
    at getAbsoluteAssetRecord (/Users/andrew/Work/Code/projects/Failure/Mobile/ReactNative/failure/node_modules/@expo/metro/node_modules/metro/src/Assets.js:114:17)
    at getAsset (/Users/andrew/Work/Code/projects/Failure/Mobile/ReactNative/failure/node_modules/@expo/metro/node_modules/metro/src/Assets.js:224:18)
    at Server._processSingleAssetRequest (/Users/andrew/Work/Code/projects/Failure/Mobile/ReactNative/failure/node_modules/@expo/metro/node_modules/metro/src/Server.js:436:20)
    at Server._processRequest (/Users/andrew/Work/Code/projects/Failure/Mobile/ReactNative/failure/node_modules/@expo/metro/node_modules/metro/src/Server.js:535:7)

I've confirmed that the file name had a space in it; when I renamed it to not have a space, it works just fine. Strangely, this did not happen in 0.79 of React Native; I recently upgraded to 0.81 of RN, and this happened. Though it says it's expo related, when forking this repo, the node_module file for Assets.js was the same as here, so I assume it's the correct repo.

Dominant language
JavaScript
Stars
5.6k
Forks
699
Avg merge
2d 16h
Merged PRs (30d)
33

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from react/metro

All issues in react/metro

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.