[Bug]: prebuild can't find onesignal-expo-plugin directory
crieggalder opened this issue · 7 comments
What happened?
Hi all - thanks for your work on this.
I'm in a monorepo with the following structure:
root
node_modules // Hoisted by Lerna, includes onesignal-expo-plugin, other Expo app dependencies, and dependencies for other apps in monorepo
packages
app // Dir for our Expo app
node_modules // Includes some core Expo dependencies e.g. expo, metro, react-native. Not sure why these land here but hasn't been an issue so far.
ios
android
...etc.
Running npx expo prebuild --clean
from /packages/app
errors. Looks like prebuild can't find the plugin dir.
onesignal-expo-plugin: Couldn't read file:node_modules/onesignal-expo-plugin/build/support/serviceExtensionFiles/NotificationService.h
⠋ Config syncingnode:internal/process/promises:288
triggerUncaughtException(err, true /* fromPromise */);
^
[Error: ENOENT: no such file or directory, open 'node_modules/onesignal-expo-plugin/build/support/serviceExtensionFiles/NotificationService.h'] {
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: 'node_modules/onesignal-expo-plugin/build/support/serviceExtensionFiles/NotificationService.h'
}
Steps to reproduce?
See above
What did you expect to happen?
I expected prebuild to be able to find the plugin directory and work without error.
OneSignal Expo SDK version
1.3.0
Platform
No response
Relevant log output
npx expo prebuild --clean
Your git working tree is clean
To revert the changes after this command completes, you can run the following:
git clean --force && git reset --hard
✔ Cleared android, ios code
✔ Created native projects | gitignore skipped
› Metro skipped: Project metro.config.js does not match prebuild template.
› Ensure the project uses @expo/metro-config.
Learn more
✔ Updated package.json and added index.js entry point for iOS and Android
› Installing using Yarn
onesignal-expo-plugin: Couldn't read file:node_modules/onesignal-expo-plugin/build/support/serviceExtensionFiles/NotificationService.h
⠋ Config syncingnode:internal/process/promises:288
triggerUncaughtException(err, true /* fromPromise */);
^
[Error: ENOENT: no such file or directory, open 'node_modules/onesignal-expo-plugin/build/support/serviceExtensionFiles/NotificationService.h'] {
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: 'node_modules/onesignal-expo-plugin/build/support/serviceExtensionFiles/NotificationService.h'
}
Node.js v18.12.1
Code of Conduct
- I agree to follow this project's Code of Conduct
FYI we are working around this with a postinstall script in package.json that copies the plugin dir from the top-level node_modules dir to the Expo node_modules dir
@crieggalder thanks for reporting!
There was a fairly recent change to support monorepos, but it looking for and uses the first node_modules
directory up the parent chain. It looks like, instead of looking for the existence of a node_modules
directory we should be looking for the existence of a node_modules/onesignal-expo-plugin
directory, to cover your scenario.
Note there is also this in-progress PR which I think would also resolve your issue, but I haven't been able to verify that as a fix.
I am getting the exact same issue using Yarn Workspaces (v3), which hoist dependencies as described with Lerna.
@crieggalder / @alexbchr We've released v1.3.1 of the plugin which includes #138 , can you please see if the issue still exists? Thanks!
@brismithers I can confirm that it fixed it for me! Thanks for the quick release 😉
Thanks @alexbchr for confirming!