Closed
Description
I like the cheerio
library. I want to use cheerio
in react native
, but it didn't work
import cio from 'cheerio';
Loading dependency graph, done.
error: bundling: UnableToResolveError: Unable to resolve module `events` from `G:\React-Native\test\node_modules\htmlparser2\lib\Parser.js`: Module dop or in these directories:
Activity
niocncn commentedon Jul 24, 2017
Same issue
vvo commentedon Jul 25, 2017
Can you try to:
I know this seems counter intuitive, in Node.js this is available by default, maybe not in react native?
niocncn commentedon Jul 25, 2017
Not work for me, next error appear:
Unable to resolve module 'stream'
=((vvo commentedon Jul 25, 2017
Seems like a recurrent issue in the react-native repository, ask the question here and provide a reproduction repository. This is not specific to cheerio.
Lizhooh commentedon Jul 25, 2017
I found the problem.
htmlparser2 useing nodejs API.
cause to be unable to work on react native.
niocncn commentedon Jul 27, 2017
after installing 'react-native-fence-html' problem disappear, it seems to me it includes all required dependencies )
Lizhooh commentedon Jul 27, 2017
@niocncn One of the libraries helped me, look https://github.com/oyyd/cheerio-without-node-native
No errors, can correctly parse.
fb55 commentedon Jul 28, 2017
You can install the missing packages from npm (
events
,stream
andutils
afaict) and they will be automatically picked up.I would not recommend the usage of a fork as it will make it difficult to track down issues and will delay, if not prevent, patches for bugs.
ghost commentedon Jul 29, 2017
What about
net
andurl
that are required by tough-cookie?dantman commentedon Sep 9, 2017
@fb55 The hack of requiring
stream
(a 2 year old abandoned hack) doesn't work with the newparse5
dependency in1.0.0-rc.2
.Noitidart commentedon Sep 1, 2018
Thanks very much for this topic. I had the same issue it was great to see solution right away on search.
Reducing dependency on hand written functions
czy0729 commentedon Jun 30, 2019
@Lizhooh 世界上最远的距离就是我不知道轮子的存在
2 remaining items