johnp

johnp

Test-Driven React: npm resolution error with jest-styled-components@6.3.1 Page 113

When installing jest-styled-components@6.3.1 in Chapter 4 npm raises a resolution error stating jest-styled-components@6.3.1 is not compatible with styled-components@4.4.1.

I tried upgrading both components to the latest versions but this caused the test
expect(mounted).toHaveStyleRule(‘width’, ‘100%’);
and any subsequent uses of toHaveStyleRule to fail, not finding the style rules in the object.

The error was resolved by using the additional --legacy-peer-deps flag when installing jest-styled-components@6.3.1 which gives toHaveStyleRule to work as expect. However a “command sh -c jest” error is raised when the tests are run although all the tests pass.

Don’t you just love npm/javascript packages!

Cheers

John

Initial npm error report below:

npm resolution error report

2021-03-08T02:14:00.603Z

While resolving: test-driven-carousel@1.0.0
Found: styled-components@4.4.1
node_modules/styled-components
styled-components@"^4.1.1" from the root project

Could not resolve dependency:
peer styled-components@"^2.0.0 || ^3.0.2" from jest-styled-components@6.3.1
node_modules/jest-styled-components
dev jest-styled-components@“6.3.1” from the root project

Fix the upstream dependency conflict, or retry
this command with --force, or --legacy-peer-deps
to accept an incorrect (and potentially broken) dependency resolution.

Raw JSON explanation object:

{
“code”: “ERESOLVE”,
“current”: {
“name”: “styled-components”,
“version”: “4.4.1”,
“whileInstalling”: {
“name”: “test-driven-carousel”,
“version”: “1.0.0”,
“path”: “/home/scooter/Projects/test-driven-carousel”
},
“location”: “node_modules/styled-components”,
“dependents”: [
{
“type”: “prod”,
“name”: “styled-components”,
“spec”: “^4.1.1”,
“from”: {
“location”: “/home/scooter/Projects/test-driven-carousel”
}
}
]
},
“edge”: {
“type”: “peer”,
“name”: “styled-components”,
“spec”: “^2.0.0 || ^3.0.2”,
“error”: “INVALID”,
“from”: {
“name”: “jest-styled-components”,
“version”: “6.3.1”,
“whileInstalling”: {
“name”: “test-driven-carousel”,
“version”: “1.0.0”,
“path”: “/home/scooter/Projects/test-driven-carousel”
},
“location”: “node_modules/jest-styled-components”,
“dependents”: [
{
“type”: “dev”,
“name”: “jest-styled-components”,
“spec”: “6.3.1”,
“from”: {
“location”: “/home/scooter/Projects/test-driven-carousel”
}
}
]
}
},
“peerConflict”: null,
“strictPeerDeps”: false,
“force”: false
}

Popular Pragmatic Bookshelf topics Top

Razor54672
The answer to 3rd Problem of Chapter 5 (Making Choices) of “Practical Programming, Third Edition” seems incorrect in the given answer ke...
New
Alexandr
Hi everyone! There is an error on the page 71 in the book “Programming machine learning from coding to depp learning” P. Perrotta. You c...
New
raul
Hi Travis! Thank you for the cool book! :slight_smile: I made a list of issues and thought I could post them chapter by chapter. I’m rev...
New
herminiotorres
Hi! I know not the intentions behind this narrative when called, on page XI: mount() |> handle_event() |> render() but the correc...
New
adamwoolhether
When trying to generate the protobuf .go file, I receive this error: Unknown flag: --go_opt libprotoc 3.12.3 MacOS 11.3.1 Googling ...
New
patoncrispy
I’m new to Rust and am using this book to learn more as well as to feed my interest in game dev. I’ve just finished the flappy dragon exa...
New
AndyDavis3416
@noelrappin Running the webpack dev server, I receive the following warning: ERROR in tsconfig.json TS18003: No inputs were found in c...
New
jskubick
I think I might have found a problem involving SwitchCompat, thumbTint, and trackTint. As entered, the SwitchCompat changes color to hol...
New
dtonhofer
@parrt In the context of Chapter 4.3, the grammar Java.g4, meant to parse Java 6 compilation units, no longer passes ANTLR (currently 4....
New
gorkaio
root_layout: {PentoWeb.LayoutView, :root}, This results in the following following error: no “root” html template defined for PentoWeb...
New

Other popular topics Top

Exadra37
I am thinking in building or buy a desktop computer for programing, both professionally and on my free time, and my choice of OS is Linux...
New
New
AstonJ
You might be thinking we should just ask who’s not using VSCode :joy: however there are some new additions in the space that might give V...
New
AstonJ
Just done a fresh install of macOS Big Sur and on installing Erlang I am getting: asdf install erlang 23.1.2 Configure failed. checking ...
New
AstonJ
This looks like a stunning keycap set :orange_heart: A LEGENDARY KEYBOARD LIVES ON When you bought an Apple Macintosh computer in the e...
New
Margaret
Hello everyone! This thread is to tell you about what authors from The Pragmatic Bookshelf are writing on Medium.
1139 25467 754
New
New
husaindevelop
Inside our android webview app, we are trying to paste the copied content from another app eg (notes) using navigator.clipboard.readtext ...
New
PragmaticBookshelf
Author Spotlight: Karl Stolley @karlstolley Logic! Rhetoric! Prag! Wow, what a combination. In this spotlight, we sit down with Karl ...
New
AnfaengerAlex
Hello, I’m a beginner in Android development and I’m facing an issue with my project setup. In my build.gradle.kts file, I have the foll...
New

Sub Categories: