-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
What version of Turborepo are you using?
1.1.1
What package manager are you using / does the bug impact?
Yarn v1
What operating system are you using?
Mac
Describe the Bug
Hello,
I've been trying to implement a turbo pipeline to cache the result of a "post-install" command of a react-native module of a monorepo.
The post-install main job is to perform a pod install
command in order to setup the cocoa-pods with the iOS portion of the react-native app.
My goal is to cache everything under ios/Pods/**
-- and to always use the turbo-repo cache unless the root yarn.lock changes.
Everything seems to be working as it should up until turbo tries to populate the cache. Indeed I always run into a runtime: failed to create new OS thread
error -- and the node_modules/.cache/turbo/{CACHE ID}/**
content is always partial.
$ yarn postinstall --force
output:
gabriel@mt acme-io.app % yarn postinstall --force
yarn run v1.22.15
$ YARN_LOCK_CHECKSUM="$(shasum ./yarn.lock)" turbo run _postinstall --scope="@acme-io/app-mobile" --ignore="apps/mobile/**/*" --force
• Packages in scope: @acme-io/app-mobile
• Running _postinstall in 1 packages
@acme-io/app-mobile:_postinstall: cache bypass, force executing 73dc0c2895bafc41
@acme-io/app-mobile:_postinstall: $ node ./bin/postInstall
@acme-io/app-mobile:_postinstall: patch-package 6.2.2
@acme-io/app-mobile:_postinstall: Applying patches...
@acme-io/app-mobile:_postinstall: No patch files found
@acme-io/app-mobile:_postinstall:
@acme-io/app-mobile:_postinstall: ✔︎ Solidarity checks valid
@acme-io/app-mobile:_postinstall: Jetifier found 0 file(s) to forward-jetify. Using 16 workers...
@acme-io/app-mobile:_postinstall: Installing unimodules:
@acme-io/app-mobile:_postinstall: expo-constants@9.3.5 from ../../../node_modules/expo-constants/ios
@acme-io/app-mobile:_postinstall: expo-file-system@9.3.0 from ../../../node_modules/expo-file-system/ios
@acme-io/app-mobile:_postinstall: expo-image-loader@1.3.0 from ../../../node_modules/expo-image-loader/ios
@acme-io/app-mobile:_postinstall: expo-linear-gradient@9.2.0 from ../../../node_modules/expo-linear-gradient/ios
@acme-io/app-mobile:_postinstall: expo-localization@9.1.0 from ../../../node_modules/expo-localization/ios
@acme-io/app-mobile:_postinstall: expo-permissions@10.0.0 from ../../../node_modules/expo-permissions/ios
@acme-io/app-mobile:_postinstall: unimodules-app-loader@1.4.0 from ../../../node_modules/unimodules-app-loader/ios
@acme-io/app-mobile:_postinstall: unimodules-barcode-scanner-interface@5.4.0 from ../../../node_modules/unimodules-barcode-scanner-interface/ios
@acme-io/app-mobile:_postinstall: unimodules-camera-interface@5.4.0 from ../../../node_modules/unimodules-camera-interface/ios
@acme-io/app-mobile:_postinstall: unimodules-constants-interface@5.4.0 from ../../../node_modules/unimodules-constants-interface/ios
@acme-io/app-mobile:_postinstall: unimodules-core@6.0.0 from ../../../node_modules/@unimodules/core/ios
@acme-io/app-mobile:_postinstall: unimodules-face-detector-interface@5.4.0 from ../../../node_modules/unimodules-face-detector-interface/ios
@acme-io/app-mobile:_postinstall: unimodules-file-system-interface@5.4.0 from ../../../node_modules/unimodules-file-system-interface/ios
@acme-io/app-mobile:_postinstall: unimodules-font-interface@5.4.0 from ../../../node_modules/unimodules-font-interface/ios
@acme-io/app-mobile:_postinstall: unimodules-image-loader-interface@5.4.0 from ../../../node_modules/unimodules-image-loader-interface/ios
@acme-io/app-mobile:_postinstall: unimodules-permissions-interface@5.4.0 from ../../../node_modules/unimodules-permissions-interface/ios
@acme-io/app-mobile:_postinstall: unimodules-react-native-adapter@5.7.0 from ../../../node_modules/@unimodules/react-native-adapter/ios
@acme-io/app-mobile:_postinstall: unimodules-sensors-interface@5.4.0 from ../../../node_modules/unimodules-sensors-interface/ios
@acme-io/app-mobile:_postinstall: unimodules-task-manager-interface@5.4.0 from ../../../node_modules/unimodules-task-manager-interface/ios
@acme-io/app-mobile:_postinstall:
@acme-io/app-mobile:_postinstall: Adding a custom script phase for Pod RNFBApp: [RNFB] Core Configuration
@acme-io/app-mobile:_postinstall: Auto-linking React Native modules for target `AcmeIOApp`: RNCAsyncStorage, RNCMaskedView, RNCallKeep, RNDeviceInfo, RNFBApp, RNFBAppCheck, RNFBAuth, RNFBFirestore, RNFBFunctions, RNFBMessaging, RNGestureHandler, RNKeychain, RNScreens, RNVoipPushNotification, react-native-agora, and react-native-safe-area-context
@acme-io/app-mobile:_postinstall: Analyzing dependencies
@acme-io/app-mobile:_postinstall: Downloading dependencies
@acme-io/app-mobile:_postinstall: Generating Pods project
@acme-io/app-mobile:_postinstall: Integrating client project
@acme-io/app-mobile:_postinstall: Pod installation complete! There are 84 dependencies from the Podfile and 95 total pods installed.
Tasks: 1 successful, 1 total
Cached: 0 cached, 1 total
Time: 39.082s
runtime: failed to create new OS thread
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Expected Behavior
- Turbo should run without crashing
- All the files matching the
outputs: []
globs should be cached.
To Reproduce
turbo.json
{
"pipeline": {
"_postinstall": { },
"@acme-io/app-mobile#_postinstall": {
"dependsOn": [ "$YARN_LOCK_CHECKSUM" ],
"outputs": [
"ios/Pods/**"
]
}
}
}
package.json
{
"name": "turborepo-basic-shared",
"version": "0.0.0",
"private": true,
"workspaces": [
"apps/*"
],
"scripts": {
"postinstall": "YARN_LOCK_CHECKSUM=\"$(shasum ./yarn.lock)\" turbo run _postinstall --scope=\"@acme-io/app-mobile\" --ignore=\"apps/mobile/**/*\""
},
"devDependencies": {
"prettier": "^2.5.1",
"turbo": "latest"
},
"engines": {
"npm": ">=7.0.0",
"node": ">=14.0.0"
},
"packageManager": "yarn@1.22.15"
}
apps/mobile/package.json
{
"name": "@acme-io/app-mobile",
"version": "0.0.1",
"private": true,
"scripts": {
...
"_postinstall": "node ./bin/postInstall"
}
...
}
apps/mobile/bin/postInstall
#!/usr/bin/env node
const childProcess = require("child_process")
const os = require("os")
/**
* Do all things that need to be done after installing packages
*
* Yes, it slows down package installation a little, but it's nice to not
* have to remember these extra steps.
*/
;[
// Patch all the necessary modules.
{ command: "npx patch-package" },
// Make sure we're set up correctly
{ command: "solidarity" },
// Kill the metro bundler if it's running.
{ command: 'pkill -f "cli.js start" || set exit 0', onlyPlatforms: ["darwin", "linux"] },
// Help wanted: Add the windows version here. { command: "????", onlyPlatforms: ["win32"] },
// Make sure our native modules are androidX-happy
{ command: "jetify" },
// on iOS, make sure our native modules are installed
{ command: "pod install", cwd: "ios", onlyPlatforms: ["darwin"] },
]
.filter(({ onlyPlatforms }) => !onlyPlatforms || onlyPlatforms.includes(os.platform()))
.forEach((commandAndOptions) => {
const { command, onlyPlatform: _, ...options } = commandAndOptions
try {
childProcess.execSync(command, {
stdio: "inherit",
...options,
})
} catch (error) {
process.exit(error.status)
}
})