question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

error: bundling failed: Error: ENOENT: no such file or directory, scandir '/Users/myuser/MyProject/mycomponents/node_modules/private-dependency/images'

See original GitHub issue

Hello,

I’m facing this error when trying to build for iOS :

error: bundling failed: Error: ENOENT: no such file or directory, scandir '/Users/remigarcia/Projets/MobileApp/component/navigation/node_modules/private-dependency/images'
    at Object.readdirSync (fs.js:779:3)
    at Object.getDirFiles (/Users/remigarcia/Projets/MobileApp/node_modules/metro/src/node-haste/DependencyGraph.js:103:34)
    at Map._factory (/Users/remigarcia/Projets/MobileApp/node_modules/metro/src/node-haste/AssetResolutionCache.js:41:36)
    at Map.get (/Users/remigarcia/Projets/MobileApp/node_modules/metro/src/node-haste/lib/MapWithDefaults.js:23:24)
    at AssetResolutionCache.resolve (/Users/remigarcia/Projets/MobileApp/node_modules/metro/src/node-haste/AssetResolutionCache.js:91:43)
    at resolveAsset (/Users/remigarcia/Projets/MobileApp/node_modules/metro/src/node-haste/DependencyGraph.js:229:36)
    at resolveAssetFiles (/Users/remigarcia/Projets/MobileApp/node_modules/metro-resolver/src/resolve.js:463:22)
    at resolveFile (/Users/remigarcia/Projets/MobileApp/node_modules/metro-resolver/src/resolve.js:349:20)
    at resolveFileOrDir (/Users/remigarcia/Projets/MobileApp/node_modules/metro-resolver/src/resolve.js:262:22)
    at Object.resolve (/Users/remigarcia/Projets/MobileApp/node_modules/metro-resolver/src/resolve.js:155:20)

So, I have a private dependency “private-dependency” with an images folder in it. In a component located in /Users/remigarcia/Projets/MobileApp/component/navigation/ i’m trying to import one of this images : import logo from 'private-dependency/images/logo.png' The bundler seems to look for the image in the folder of the component (see the error) : /Users/remigarcia/Projets/MobileApp/component/navigation/node_modules/private-dependency/images and not in the module folder.

Do I imported badly the image ?

React Native version: 0.59.8

info 
  React Native Environment Info:
    System:
      OS: macOS High Sierra 10.13.6
      CPU: (4) x64 Intel(R) Core(TM) i5-4288U CPU @ 2.60GHz
      Memory: 367.96 MB / 8.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 12.3.1 - /usr/local/Cellar/node/12.3.1/bin/node
      Yarn: 1.16.0 - /usr/local/Cellar/node/12.3.1/bin/yarn
      npm: 5.6.0 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
    IDEs:
      Xcode: 10.1/10B61 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.8.3 => 16.8.3 
      react-native: 0.59.8 => 0.59.8 
    npmGlobalPackages:
      react-native-cli: 2.0.1

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
artalatcommented, Jun 11, 2019

Facing the same issue, after upgrading from 0.57.8. Pretty sure this is a bug

1reaction
guhungrycommented, May 23, 2019

Err, you need import logo from './private-dependency/images/logo.png'.

Read more comments on GitHub >

github_iconTop Results From Across the Web

npm - bundling failed: Error: ENOENT: no such file or directory ...
Just closing and re-opening the cmd terminal or whatever you are using to run the metro bundler worked for me.
Read more >
Error: ENOENT: no such file or directory, scandir ... - YouTube
nodejsError: ENOENT : no such file or directory, scandir '**/node_modules/node-sass/vendor' | Module build failed (from .
Read more >
Error: Enoent: No Such File Or Directory, Scandir React Native
Hi all I'm learning React Native and trying to add React Native paper to my Native Notes 4 : error: bundling failed: Error:...
Read more >
React Native Notes 4 : error: bundling failed: Error: ENOENT
ENOENT problem generally appears after ejecting from Expo. ... bundling failed: Error: ENOENT: no such file or directory, uv_cwd problem.
Read more >
Fix "no such file or directory, scandir" - David Walsh Blog
After 15+ years in the web development industry, and seeing the landscape of tooling change, I've really lost patience with tooling errors.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found