Node.js 15与pullstate 1.20.x的依赖问题



我想在我的react项目中使用pullstate.js,但似乎不可能在Node.js 15中使用它。我已经在Node.js 13中尝试过了,它可以工作。有人能帮忙吗?在这个例子中,我创建了一个普通的react应用,并尝试添加依赖项。

包,json

"

{
"name": "my-app",
"version": "0.1.0",
"private": true,
"dependencies": {
"@popperjs/core": "^2.9.0",
"@testing-library/jest-dom": "^5.11.9",
"@testing-library/react": "^11.2.5",
"@testing-library/user-event": "^12.8.1",
"ajv": "^6.12.6",
"bootstrap": "^4.5.3",
"moment": "^2.29.1",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-scripts": "4.0.3",
"web-vitals": "^1.1.0",
"pullstate":"1.20.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}

"

这是我安装npm后得到的错误。


code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: my-app@0.1.0
npm ERR! Found: react@17.0.1
npm ERR! node_modules/react
npm ERR!   react@"^17.0.1" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.12.0" from pullstate@1.20.1
npm ERR! node_modules/pullstate
npm ERR!   pullstate@"1.20.1" 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 version 7对对等依赖不匹配更加严格。

要获得旧的行为,运行npm install--legacy-peer-deps,正如错误信息中所说的。


我刚刚发布了Pullstate版本1.21.0 -它为React设置了更广泛的对等依赖,包括^1.17.0 -我认为这应该可以解决这个问题。

最新更新