rn-pdf-reader-js icon indicating copy to clipboard operation
rn-pdf-reader-js copied to clipboard

Support Expo v 43

Open julste opened this issue 2 years ago • 17 comments

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

julste avatar Dec 14 '21 16:12 julste

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

sunn-e avatar Dec 14 '21 16:12 sunn-e

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.

julste avatar Dec 15 '21 07:12 julste

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.

alessioguglielmo avatar Jan 16 '22 22:01 alessioguglielmo

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

Engazan avatar Jan 22 '22 17:01 Engazan

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

silverax avatar Jan 24 '22 19:01 silverax

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"

Engazan avatar Jan 25 '22 06:01 Engazan

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.

silverax avatar Jan 25 '22 18:01 silverax

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

julste avatar Jan 25 '22 20:01 julste

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}
/>

Engazan avatar Feb 08 '22 06:02 Engazan

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

nicobermudez avatar Feb 24 '22 14:02 nicobermudez

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.

timknapp-qs avatar Apr 06 '22 20:04 timknapp-qs

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

visharma14 avatar May 25 '22 11:05 visharma14

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?

FadilSmajilbasic avatar May 25 '22 21:05 FadilSmajilbasic

Solution anyone?

faisal07m avatar Jun 28 '22 14:06 faisal07m

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.

FadilSmajilbasic avatar Jun 29 '22 20:06 FadilSmajilbasic

Solution anyone?

install with yarn and it should work

oleg1994 avatar Jun 30 '22 12:06 oleg1994

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

TomasSestak avatar Aug 17 '22 08:08 TomasSestak