Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Expo v 43 #162

Open
julste opened this issue Dec 14, 2021 · 17 comments
Open

Support Expo v 43 #162

julste opened this issue Dec 14, 2021 · 17 comments

Comments

@julste
Copy link

julste commented Dec 14, 2021

Issue Description

I'm trying to install the pdf reader using npm install rn-pdf-reader-js but got the error that dependencies cannot be resolved:

npm ERR! Could not resolve dependency:
npm ERR! peer expo@">= 33.0.x < 37.0.x" from [email protected]
npm ERR! node_modules/rn-pdf-reader-js
npm ERR!   rn-pdf-reader-js@"*" from the root project

Steps to Reproduce / Code Snippets

npm install rn-pdf-reader-js

@sunn-e
Copy link

sunn-e commented Dec 14, 2021

I tried "expo install rn-pdf-reader-js" and it works fine.

@julste
Copy link
Author

julste commented Dec 15, 2021

Thanks for your reply, I've tried it again with new app but it didn't work.

Here my steps:

expo init my-app
expo install rn-pdf-reader-js

Result:
image

Log:

0 verbose cli [
0 verbose cli   '/usr/local/bin/node',
0 verbose cli   '/usr/local/bin/npm',
0 verbose cli   'install',
0 verbose cli   '--save',
0 verbose cli   'rn-pdf-reader-js'
0 verbose cli ]
1 info using [email protected]
2 info using [email protected]
3 timing npm:load:whichnode Completed in 0ms
4 timing config:load:defaults Completed in 1ms
5 timing config:load:file:/usr/local/lib/node_modules/npm/npmrc Completed in 1ms
6 timing config:load:builtin Completed in 1ms
7 timing config:load:cli Completed in 2ms
8 timing config:load:env Completed in 0ms
9 timing config:load:file:/...my-app2/.npmrc Completed in 1ms
10 timing config:load:project Completed in 1ms
11 timing config:load:file:/home/.../.npmrc Completed in 0ms
12 timing config:load:user Completed in 0ms
13 timing config:load:file:/usr/local/etc/npmrc Completed in 0ms
14 timing config:load:global Completed in 0ms
15 timing config:load:validate Completed in 1ms
16 timing config:load:credentials Completed in 1ms
17 timing config:load:setEnvs Completed in 0ms
18 timing config:load Completed in 7ms
19 timing npm:load:configload Completed in 7ms
20 timing npm:load:setTitle Completed in 1ms
21 timing config:load:flatten Completed in 2ms
22 timing npm:load:display Completed in 3ms
23 verbose logfile /home/.../.npm/_logs/2021-12-15T07_52_36_822Z-debug-0.log
24 timing npm:load:logFile Completed in 3ms
25 timing npm:load:timers Completed in 0ms
26 timing npm:load:configScope Completed in 0ms
27 timing npm:load Completed in 14ms
28 timing arborist:ctor Completed in 0ms
29 silly logfile start cleaning logs, removing 1 files
30 timing idealTree:init Completed in 388ms
31 timing idealTree:userRequests Completed in 1ms
32 silly idealTree buildDeps
33 silly fetch manifest rn-pdf-reader-js@*
34 timing arborist:ctor Completed in 0ms
35 http fetch GET 200 https://registry.npmjs.org/rn-pdf-reader-js 307ms (cache hit)
36 silly fetch manifest expo@~43.0.2
37 http fetch GET 200 https://registry.npmjs.org/expo 4ms (cache hit)
38 silly fetch manifest expo@>= 33.0.x < 37.0.x
39 timing idealTree Completed in 714ms
40 timing command:install Completed in 722ms
41 verbose stack Error: unable to resolve dependency tree
41 verbose stack     at Arborist.[failPeerConflict] (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1362:25)
41 verbose stack     at Arborist.[loadPeerSet] (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1328:34)
41 verbose stack     at async Arborist.[buildDepStep] (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:935:11)
41 verbose stack     at async Arborist.buildIdealTree (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:216:7)
41 verbose stack     at async Promise.all (index 1)
41 verbose stack     at async Arborist.reify (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:149:5)
41 verbose stack     at async Install.exec (/usr/local/lib/node_modules/npm/lib/commands/install.js:157:5)
41 verbose stack     at async module.exports (/usr/local/lib/node_modules/npm/lib/cli.js:66:5)
42 verbose cwd /home/../my-app2
43 verbose Linux 5.4.0-91-generic
44 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "--save" "rn-pdf-reader-js"
45 verbose node v12.17.0
46 verbose npm  v8.3.0
47 error code ERESOLVE
48 error ERESOLVE unable to resolve dependency tree
49 error
50 error While resolving: [email protected]
50 error Found: [email protected]
50 error node_modules/expo
50 error   expo@"~43.0.2" from the root project
50 error
50 error Could not resolve dependency:
50 error peer expo@">= 33.0.x < 37.0.x" from [email protected]
50 error node_modules/rn-pdf-reader-js
50 error   rn-pdf-reader-js@"*" from the root project
50 error
50 error Fix the upstream dependency conflict, or retry
50 error this command with --force, or --legacy-peer-deps
50 error to accept an incorrect (and potentially broken) dependency resolution.

I'm using a Ubuntu 20 if it makes any difference.

@alessioguglielmo
Copy link

Same thing for me... any news ?

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: undefined@undefined
npm ERR! Found: [email protected]
npm ERR! node_modules/expo
npm ERR!   expo@"^41.0.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer expo@">= 33.0.x < 37.0.x" from [email protected]
npm ERR! node_modules/rn-pdf-reader-js
npm ERR!   rn-pdf-reader-js@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

@Engazan
Copy link

Engazan commented Jan 22, 2022

its simple you all miss this part, tested on expo 43, 44 all works without any problem

👉Install react-native-webview on your own!
👉Install expo-file-system on your own!
👉Install expo-constants on your own!

yarn add react-native-webview
expo install expo-constants expo-file-system

@silverax
Copy link

image
I do it like u suggest, still got the same error:
image

@Engazan
Copy link

Engazan commented Jan 25, 2022

image

I do it like u suggest, still got the same error:

image

So you using expo, then you should also using yarn ( cuz expo using yarn ) combining 2 package managers is bad idea, why ? Every pckage managers handles things different

Tested With yarn on expo 43 and 44 and works without any problem, just few warrnings but it works

issue here is NPM and "peerDependencies" with "expo" value ">= 33.0.x < 41.0.x" but works with "yarn"

@silverax
Copy link

that does the trick.
Thanks a lot.
I also had to change the environment from ubuntu to windows since it is not easy to run yarn on ubuntu.

@julste
Copy link
Author

julste commented Jan 25, 2022

Hmm how can you use it on Ubuntu? I have only Ubuntu.

@Engazan
Copy link

Engazan commented Feb 8, 2022

that does the trick. Thanks a lot. I also had to change the environment from ubuntu to windows since it is not easy to run yarn on ubuntu.

but there is problem when you biuld your project with EAS

so u can use your own solution if u using just Read ability

install webview expo install react-native-webview

<WebView
    source={{uri: Platform.OS === 'android' ? `https://docs.google.com/viewer?url=${documentData.url}` : documentData.url}}
    //source={{uri: Platform.OS === 'android' ? `https://drive.google.com/viewerng/viewer?embedded=true&url=${documentData.url}` : documentData.url}}
    onError={(e) => {
        console.log('PDF e - ' + e);
    }}
    allowFileAccess={Platform.select({android: true, ios: false})}
    allowFileAccessFromFileURLs={Platform.select({android: true, ios: false})}
    allowUniversalAccessFromFileURLs={Platform.select({android: true, ios: false})}
    // scalesPageToFit={Platform.select({android: false})}
    mixedContentMode={Platform.select({android: 'always', ios: undefined})}
    sharedCookiesEnabled={false}
/>

@nicobermudez
Copy link

Any updates on this one? Ideally this shouldn't be contingent on switching package managers. This clearly isn't supporting Expo SDK's from 41+ because of it's peer dependency: "expo": ">= 33.0.x < 41.0.x", Ideally, we can get actual support for Expo SDK 41+ and future versions

@timknapp-qs
Copy link

It would be nice if a maintainer just approved and merged the pull request that someone submitted to update the versions of the peer dependencies, then it should work for yarn AND npm.

@visharma14
Copy link

that does the trick. Thanks a lot. I also had to change the environment from ubuntu to windows since it is not easy to run yarn on ubuntu.

but there is problem when you biuld your project with EAS

so u can use your own solution if u using just Read ability

install webview expo install react-native-webview

<WebView
    source={{uri: Platform.OS === 'android' ? `https://docs.google.com/viewer?url=${documentData.url}` : documentData.url}}
    //source={{uri: Platform.OS === 'android' ? `https://drive.google.com/viewerng/viewer?embedded=true&url=${documentData.url}` : documentData.url}}
    onError={(e) => {
        console.log('PDF e - ' + e);
    }}
    allowFileAccess={Platform.select({android: true, ios: false})}
    allowFileAccessFromFileURLs={Platform.select({android: true, ios: false})}
    allowUniversalAccessFromFileURLs={Platform.select({android: true, ios: false})}
    // scalesPageToFit={Platform.select({android: false})}
    mixedContentMode={Platform.select({android: 'always', ios: undefined})}
    sharedCookiesEnabled={false}
/>

how to used webview to show base64 string

@FadilSmajilbasic
Copy link

It would be nice if a maintainer just approved and merged the pull request that someone submitted to update the versions of the peer dependencies, then it should work for yarn AND npm.

Is this repo still maintained?

@faisal07m
Copy link

Solution anyone?

@FadilSmajilbasic
Copy link

Solution anyone?

@faisal07m I managed to bypass the rn-pdf-reader-js entirely and used the google docs pdf preview function with a WebView.

<WebView
    style={styles.pdf}
    source={{ uri: "https://docs.google.com/gview?embedded=true&url=" + file.URL }}
    scrollEnabled={true}
    bounces={false}
    originWhitelist={["*"]}
/>

It provided enough functionality for my usage.

@oleg1994
Copy link

Solution anyone?

install with yarn and it should work

@TomasSestak
Copy link

We are just using the --legacy-peer-deps flag when npm install

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests