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

cheerio 1.0.0 breaks bundling of react native #4032

Open
UNIDY2002 opened this issue Aug 16, 2024 · 6 comments · May be fixed by #4033
Open

cheerio 1.0.0 breaks bundling of react native #4032

UNIDY2002 opened this issue Aug 16, 2024 · 6 comments · May be fixed by #4033

Comments

@UNIDY2002
Copy link

Minimal example: https://github.com/thu-info-community/thu-info-app/actions/runs/10414518614/job/28843638237?pr=587

Error: Unable to resolve module node:stream from /home/runner/work/thu-info-app/thu-info-app/node_modules/cheerio/dist/commonjs/index.js: node:stream could not be found within the project or in these directories:
  ../../node_modules
error Unable to resolve module node:stream from /home/runner/work/thu-info-app/thu-info-app/node_modules/cheerio/dist/commonjs/index.js: node:stream could not be found within the project or in these directories:
  ../../node_modules
  node_modules
  ../../node_modules
  49 | const undici = __importStar(require("undici"));
  50 | const whatwg_mimetype_1 = __importDefault(require("whatwg-mimetype"));
> 51 | const node_stream_1 = require("node:stream");
     |                                ^
  52 | const options_js_1 = require("./options.js");
  53 | const load_parse_js_1 = require("./load-parse.js");
  54 | /**.
  node_modules
  ../../node_modules
  49 | const undici = __importStar(require("undici"));
  50 | const whatwg_mimetype_1 = __importDefault(require("whatwg-mimetype"));
> 51 | const node_stream_1 = require("node:stream");
     |                                ^
  52 | const options_js_1 = require("./options.js");
  53 | const load_parse_js_1 = require("./load-parse.js");
  54 | /**
    at ModuleResolver.resolveDependency (/home/runner/work/thu-info-app/thu-info-app/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:153:15)
    at DependencyGraph.resolveDependency (/home/runner/work/thu-info-app/thu-info-app/node_modules/metro/src/node-haste/DependencyGraph.js:279:43)
    at /home/runner/work/thu-info-app/thu-info-app/node_modules/metro/src/lib/transformHelpers.js:176:21
    at resolveDependencies (/home/runner/work/thu-info-app/thu-info-app/node_modules/metro/src/DeltaBundler/buildSubgraph.js:56:25)
    at visit (/home/runner/work/thu-info-app/thu-info-app/node_modules/metro/src/DeltaBundler/buildSubgraph.js:107:30)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Promise.all (index 2)
    at async visit (/home/runner/work/thu-info-app/thu-info-app/node_modules/metro/src/DeltaBundler/buildSubgraph.js:116:5)
    at async Promise.all (index 4)
    at async visit (/home/runner/work/thu-info-app/thu-info-app/node_modules/metro/src/DeltaBundler/buildSubgraph.js:116:5)

Steps to reproduce:

@grahamrb
Copy link

We're using turtle cli to do builds with React Native and error with the new Cheerio 1.0.0 release. There doesn't appear to be a way to change the package.json that turtle uses internally for the React Native build. If anyone has a work around for this please let me know.

@hengkx
Copy link

hengkx commented Aug 18, 2024

same error

@ksharma001
Copy link

ksharma001 commented Aug 22, 2024

This new tag should've been released with 2.x.x instead of 1.x.x

Auto upgrade from stable 1.0.0-rc.12 to 1.0.0 causes issues due to node version (node:: imports are not supported in node 14)

@grahamrb and to anyone else facing this issue:

I recommend you to ADD FIXED version set to the previous version in your dependencies/devDependencies of package.json so that any internal packages importing this package inherit this from your parent app :

"devDependencies": {
"cheerio": "1.0.0-rc.12",
}

use below command to verify that any internal dependency is inheriting the package from parent ( in my case it was enzyme )

npm ls cheerio

├── [email protected]
└─┬ [email protected]
└── [email protected] deduped

@ChristopherGabba
Copy link

I am also experiencing this error when upgrading:
iOS Bundling failed 10976ms node_modules/expo/AppEntry.js (4227 modules) The package at "node_modules/cheerio/dist/commonjs/index.js" attempted to import the Node standard library module "node:stream". It failed because the native React runtime does not include the Node standard library.

glepretre added a commit to Kozea/formol that referenced this issue Sep 3, 2024
cheerio (https://github.com/cheeriojs/cheerio) has release an official 1.0.0
version after years of Release Candidate ones.

cheeriojs/cheerio#4044
cheeriojs/cheerio#4032
cheeriojs/cheerio#3987

We depend on enzyme (https://github.com/enzymejs/enzyme) which depends
on cheerio.

Enzyme has not correctly locked cheerio RC version:
enzymejs/enzyme@cafdb2b

They're working on it...
enzymejs/enzyme#2558
enzymejs/enzyme#2606
enzymejs/enzyme#2607
enzymejs/enzyme#2608
enzymejs/enzyme#2609

Meanwhile, locking cheerio here allow us to update our dependencies.

According to enzyme, Cheerio RC was the last one supported by enzyme,
even though RC12 seems to work for us.
glepretre added a commit to Kozea/formol that referenced this issue Sep 3, 2024
cheerio (https://github.com/cheeriojs/cheerio) has released an official 1.0.0
version after years of Release Candidate ones.

cheeriojs/cheerio#4044
cheeriojs/cheerio#4032
cheeriojs/cheerio#3987

We depend on enzyme (https://github.com/enzymejs/enzyme) which depends
on cheerio.

Enzyme has not correctly locked cheerio RC version:
enzymejs/enzyme@cafdb2b

They're working on it...
enzymejs/enzyme#2558
enzymejs/enzyme#2606
enzymejs/enzyme#2607
enzymejs/enzyme#2608
enzymejs/enzyme#2609

Meanwhile, locking cheerio here allow us to update our dependencies.

According to enzyme, Cheerio RC was the last one supported by enzyme,
even though RC12 seems to work for us.
@ceebows
Copy link

ceebows commented Sep 28, 2024

Reverting to 1.0.0-rc.12 should fix issue

@bangdy
Copy link

bangdy commented Sep 30, 2024

same issue. I hope to fix this issue

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

Successfully merging a pull request may close this issue.

7 participants