Reactjs 我在npm上发布的包在没有--force的情况下无法安装
我为react.js发布了我的第一个npm包。 我使用CREATEREACT库创建了它,它运行良好。 但是,它只有在我使用“npm I lancelot动画按钮--force”时才安装。如果不添加--force,将显示以下错误:Reactjs 我在npm上发布的包在没有--force的情况下无法安装,reactjs,npm,Reactjs,Npm,我为react.js发布了我的第一个npm包。 我使用CREATEREACT库创建了它,它运行良好。 但是,它只有在我使用“npm I lancelot动画按钮--force”时才安装。如果不添加--force,将显示以下错误: npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! While resolving: project_react@0.1.0
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: project_react@0.1.0
npm ERR! Found: react@17.0.2
npm ERR! node_modules/react
npm ERR! react@"^17.0.2" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.0.0" from lancelot-animated-buttons@1.0.6
npm ERR! node_modules/lancelot-animated-buttons
npm ERR! lancelot-animated-buttons@"*" 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\elson\AppData\Local\npm-cache\eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\elson\AppData\Local\npm-cache\_logs\2021-04-09T14_00_16_778Z-debug.log
这是我的npm包的package.json:
{
"name": "lancelot-animated-buttons",
"version": "1.0.5",
"description": "Animated buttons for React.js",
"author": "Elson Ramos",
"license": "MIT",
"key":["animated","buttons","react.js","ellipsis","hamburguer"],
"repository": "elson_ramos/lancelot-animated-buttons",
"main": "dist/index.js",
"module": "dist/index.modern.js",
"source": "src/index.js",
"private": false,
"engines": {
"node": ">=10"
},
"scripts": {
"build": "microbundle-crl --no-compress --format modern,cjs",
"start": "microbundle-crl watch --no-compress --format modern,cjs",
"prepare": "run-s build",
"test": "run-s test:unit test:lint test:build",
"test:build": "run-s build",
"test:lint": "eslint .",
"test:unit": "cross-env CI=1 react-scripts test --env=jsdom",
"test:watch": "react-scripts test --env=jsdom",
"predeploy": "cd example && npm install && npm run build",
"deploy": "gh-pages -d example/build"
},
"peerDependencies": {
"react": "^16.0.0"
},
"devDependencies": {
"babel-eslint": "^10.0.3",
"cross-env": "^7.0.2",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.7.0",
"eslint-config-standard": "^14.1.0",
"eslint-config-standard-react": "^9.2.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-node": "^11.0.0",
"eslint-plugin-prettier": "^3.1.1",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-react": "^7.17.0",
"eslint-plugin-standard": "^4.0.1",
"gh-pages": "^2.2.0",
"microbundle-crl": "^0.13.10",
"npm-run-all": "^4.1.5",
"prettier": "^2.0.4",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-scripts": "^3.4.1"
},
"files": [
"dist"
],
"dependencies": {
"aphrodite": "^2.4.0",
"prop-types": "^15.7.2"
}
}
我希望能够安装这个软件包而不需要强制。有人可以帮我吗?错误显示react的版本更高。因此它失败了。当您使用--force时,它将强制安装所提到的版本。能否尝试将package.json更改为最新版本,然后重试。