簡體   English   中英

酶反應 17.0.1

[英]Enzyme with react 17.0.1

我正在嘗試為 react17 安裝此酶適配器,並在安裝過程中向我拋出此錯誤:

 $ npm install --save-dev @wojtekmaj/enzyme-adapter-react-17 npm WARN ERESOLVE overriding peer dependency npm WARN Found: react@17.0.1 npm WARN node_modules/react npm WARN peer react@"^0.14.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" from mini-create-react-context@0.4.1npm WARN node_modules/mini-create-react-context npm WARN mini-create-react-context@"^0.4.0" from react-router@5.2.0 npm WARN node_modules/react-router npm WARN 4 more (react-router, react-router-dom, the root project, @wojtekmaj/enzyme-adapter-react-17) npm WARN npm WARN Could not resolve dependency: npm WARN peer react@"0.13.x || 0.14.x || ^15.0.0-0 || ^16.0.0-0" from enzyme-adapter-utils@1.14.0 npm ERR. peer react@"^0.14.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" from mini-create-react-context@0.4.1npm ERR. node_modules/mini-create-react-context npm ERR. mini-create-react-context@"^0.4.0" from react-router@5.2.0 npm ERR. node_modules/react-router npm ERR. react-router@"5.2.0" from react-router-dom@5.2.0 npm ERR. node_modules/react-router-dom npm ERR. react-router-dom@"^5.2.0" from the root project npm ERR. peer react@">=15" from react-router@5,2,0 npm ERR: node_modules/react-router npm ERR. react-router@"5.2.0" from react-router-dom@5.2.0npm ERR. node_modules/react-router-dom npm ERR. react-router-dom@"^5.2.0" from the root project npm ERR. 3 more (react-router-dom. the root project. @wojtekmaj/enzyme-adapter-react-17) npm ERR. npm ERR. Could not resolve dependency. npm ERR, peer react@"^0,14 || ^15.0:0 || ^16.0.0-alpha" from airbnb-prop-types@2.16.0 npm ERR! node_modules/enzyme-adapter-utils/node_modules/airbnb-prop-types npm ERR! airbnb-prop-types@"^2.16.0" from enzyme-adapter-utils@1.14.0 npm ERR! node_modules/enzyme-adapter-utils npm ERR! enzyme-adapter-utils@"^1.14.0" from @wojtekmaj/enzyme-adapter-react-17@0.4.1 npm ERR! node_modules/@wojtekmaj/enzyme-adapter-react-17 npm ERR! dev @wojtekmaj/enzyme-adapter-react-17@"*" 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. npm ERR! npm ERR! See C:\Users\dittl\AppData\Local\npm-cache\eresolve-report.txt for a full report.

這是一個問題,因為我使用的是 react 17.0.1? 因為在過去,我在反應 17 中使用酶適配器並且效果很好。

在您發送的鏈接中,文檔說要使用legacy-peer-deps標志。

Note for npm v7 users

enzyme's dependencies have not yet been updated to declare React 17 in peerDependencies. You need to add --legacy-peer-deps to the install command for it to work correctly.

我建議在你的命令中使用它

npm install --save-dev @wojtekmaj/enzyme-adapter-react-17 --legacy-peer-deps

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM