-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Cannot find module 'cheerio' from 'node_modules/enzyme/build/Utils.js' #2518
Comments
|
Same here for me: `
My dependencies: |
Please try pinning cheerio to |
Adding an override doesn't fix the issue with "overrides": {
"enzyme": {
"cheerio": "1.0.0.rc-3"
}
},
|
@rxgx while that should work - file an issue with npm if it doesn't - simply adding |
@ljharb what old version of npm are you using?
|
works fine with every version of npm, through the latest. That's a version specifier, not a tag name. It's what the next release of enzyme will use: https://github.com/enzymejs/enzyme/blob/master/packages/enzyme/package.json#L42 |
Is it possible that this version is missing from the registry? I get these errors even with
|
Is it possible you're not using the public registry? It's quite there: https://unpkg.com/browse/[email protected]/ |
Here's what I originally thought was the resolution before being derailed by the invalid
If you manually change the version of the |
The = syntax is a range; overrides takes a specific version - it’s not invalid in general, i just wasn’t providing an override. Overrides should be used only as a last resort. |
Looks like the change to pin it here: cafdb2b |
@nspector correct; it hasn't been published yet. it'll be in the next release. Again, you can get the benefit now merely by doing |
Try lock your |
This worked for me
|
Do you resolve this one? I have the same issue |
which file should it be put? |
@richard1230 in package.json. You should add |
Well devDependencies did not help. When I added "resolutions" it works. |
This comment was marked as resolved.
This comment was marked as resolved.
This worked perfectly! If you copy/paste the above ☝️ then make sure there isn't a period at the end! That was causing the invalid tag name issue for me |
This comment was marked as off-topic.
This comment was marked as off-topic.
This is happening because in enzyme/packages/enzyme/src/Utils.js Line 11 in 3d286a4
Notice how this imports a specific internal module from deep inside the guts of This bypasses the public API of Recently, webpack has started allowing a new field,
The real problem, then, is that enzyme/packages/enzyme/package.json Line 42 in 6e990c0
The fix for this is for |
The public api of a package is everything reachable inside it, and deep imports are always preferable since they obviate the need for treeshaking. The exports field is a node thing, webpack just supports it, and rc11 added a breaking change to use it, but as you note, prereleases can have those. Prior to this, this file was absolutely part of the public api of cheerio. You are also correct that enzyme just needs a release to fix this issue. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as outdated.
This comment was marked as outdated.
I also ran into this issue and made this PR in the Cheerio repository: Though since it's such a simple function (which could be replaced by |
That’s a fair point. Cheerio could still be used to verify the results of the function in tests. I’d be happy to accept a PR inlining that function. |
I just start receiving this message to my unit tests today, although it was working fine before
Cannot find module 'cheerio' from 'node_modules/enzyme/build/Utils.js'
Is there anything changed in serlizer.js?
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.6",
"enzyme-to-json": "^3.6.1",
The text was updated successfully, but these errors were encountered: