react-native-vision-camera: 🐛 Expo: Package "react-native-vision-camera" does not contain a valid config plugin
What
In an Expo managed app after updating the permissions in the app.json file, I’m running into an error after running: expo prebuild
Logs
Package "react-native-vision-camera" does not contain a valid config plugin.
Learn more: https://docs.expo.io/guides/config-plugins/#creating-a-plugin
Cannot use import statement outside a module
Reproducable sample
app.json
{
"expo": {
"name": "react-native-vision-test",
"slug": "react-native-vision-test",
"plugins": [
[
"react-native-vision-camera",
{
"cameraPermissionText": "App needs access to your Camera."
}
]
],
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/icon.png",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": ["**/*"],
"ios": {
"supportsTablet": true
},
"android": {
"adaptiveIcon": {
"foregroundImage": "./assets/adaptive-icon.png",
"backgroundColor": "#FFFFFF"
}
},
"web": {
"favicon": "./assets/favicon.png"
}
}
}
Environment
- Platform(s):
- expo version: 42.0.1
- expo-cli: 4.7.3
- react-native version: 42.0.0
- react-native-vision-camera version: 2.4.1
- react-native-reanimated version: 2.2.0
package.json
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject"
},
"dependencies": {
"expo": "~42.0.1",
"expo-camera": "~11.2.1",
"expo-status-bar": "~1.0.4",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-42.0.0.tar.gz",
"react-native-reanimated": "~2.2.0",
"react-native-vision-camera": "^2.4.1",
"react-native-web": "~0.13.12"
},
"devDependencies": {
"@babel/core": "~7.9.0"
},
"private": true
}
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 20 (8 by maintainers)
That error is exactly the same one as in #195, unfortunately I cannot reproduce it. There must be something wrong in the
VisionCamera.podspec
, maybe the HEADER_SEARCH_PATH for Folly is wrong? Or the.dependency
should mentionRCT-Folly
instead ofFolly
? I’d appreciate it if you could play around with that and help me get this resolved 🙏 Maybe use Reanimated’s podspec for inspirationHi @mrousavy, sorry for the late reply.
In fact, the problem with Folly affects the RN0.63 - the version which Expo 41 and 42 uses.
To make the app plugin works for Expo42 we need to modify the user Podfile.
I agree that it’s not a good practice and would be better wait for #195 get fixed.
Maybe an option can be do this only in a “dangerous branch/tag” and not promote to stable version.
I can wait for Expo43 to use it, but I don’t know if there is some other users expecting for this now.
In the last case, would be better remove
app.plugin.js
from master and add some notes in Readme for people searching for Expo support right now.Thanks for all!
Thanks!! This problem is solved, but we have another one now 😄
Inside
src/expo-plugin/withVisionCamera.ts
(line 3) theconst pkg
import is correct, with two parent directories (../../package.json
).When it’s compiled, this file exists in
lib/commonjs/expo-plugin/withVisionCamera.js
and the import doesn’t works.I changed to
../../../package.json
(three parent directories) and it works.Can you help? Thanks!
Thank you @matheusmatos! Excited to be part of the team. Also thanks for the report, I wouldn’t have noticed on my own! Latest beta (2.4.2-beta.9) now includes
app.plugin.js
in the npm package - please let me know if you find any other issues! feedback helps me getting this beta ready for a stable release faster.