profile
viewpoint

Ask questionsconcurrent builds fail due to shared use of /tmp/metro-cache/

Do you want to request a feature or report a bug?

bug

What is the current behavior?

Concurrently-running react-native builds often fail with e.g.:

ENOENT: no such file or directory, open '/tmp/metro-cache/03/2ed8513838f8bad0238a0a6032e415d1ea766f50f498e7d284ac6a05cb0b4000001234'

Error: ENOENT: no such file or directory, open '/tmp/metro-cache/03/2ed8513838f8bad0238a0a6032e415d1ea766f50f498e7d284ac6a05cb0b400001234'
    at Object.fs.openSync (fs.js:646:18)
    at Object.fs.writeFileSync (fs.js:1291:33)
    at FileStore.set (/Users/jenkins/src/node_modules/metro-cache/src/stores/FileStore.js:43:8)
    at Cache.set (/Users/jenkins/src/node_modules/metro-cache/src/Cache.js:96:31)
    at /Users/jenkins/src/node_modules/react-native/node_modules/metro/src/DeltaBundler/Transformer.js:127:13
    at Generator.next (<anonymous>)
    at step (/Users/jenkins/src/node_modules/react-native/node_modules/metro/src/DeltaBundler/Transformer.js:11:657)
    at /Users/jenkins/src/node_modules/react-native/node_modules/metro/src/DeltaBundler/Transformer.js:11:817
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)

If the current behavior is a bug, please provide the steps to reproduce and a minimal repository on GitHub that we can yarn install and yarn test.

What is the expected behavior?

I'd expect concurrently-running builds not to interfere with each other.

Please provide your exact Metro configuration and mention your Metro, node, yarn/npm version and operating system.

MacOS 10.13.3 node 8.9.4 npm 5.6.0 started seeing this when upgraded react-native from 0.55.4 to 0.57.2 => (from our package-lock.json) metro went from 0.30.2 to 0.47.1

facebook/metro

Answer questions Tobrek

That means, if I have two project on Jenkins with two different users, which both use metro, i have to configure the env variable in BOTH projects to prevent permission problems, because the /tmp/metro-cache folder depends to the first user who created it? (Or to find another workaround)

useful!

Related questions

ReferenceError: SHA-1 for file [(...).png] is not computed hot 3
i have local javascript library How do i config metro.config.js hot 2
`SHA-1 for file ... is not computed` when using `resolver.resolveRequest` hot 1
metro-config sharedBlacklist regexp without scape "\" hot 1
Follow symlinks? hot 1
`SHA-1 for file ... is not computed` when using `resolver.resolveRequest` hot 1
metro-config sharedBlacklist regexp without scape "\" hot 1
bundleReleaseJsAndAssets slow for react-native 0.60 / node v12 combo hot 1
Error: Cannot find module 'metro/src/DeltaBundler/Worker' hot 1
metro-config sharedBlacklist regexp without scape "\" hot 1
Minification can break code (but cannot be disabled?) hot 1
Error: Cannot find module 'metro/src/DeltaBundler/Worker' hot 1
RN - Error: jest-haste-map: @providesModule naming collision hot 1
Couldn't find preset "module:metro-react-native-babel-preset" when running jest hot 1
metro-config sharedBlacklist regexp without scape "\" hot 1
source:https://uonfu.com/
Github User Rank List