NVM仅装Node 19.8.1,npm/yarn却用Node 10.19.0安装依赖报错
问题:Node版本不兼容导致npm/yarn install失败
运行npm install或yarn install时频繁出现以下报错:
error d3-chord@3.0.1: The engine "node" is incompatible with this module. Expected version ">=12". Got "10.19.0" error Found incompatible module.
环境确认
已通过NVM仅安装Node 19.8.1版本,且当前终端已切换至该版本,执行node -v返回v19.8.1。
项目package.json内容
项目1
{ "name": "datta-able-react-hook-reactstrap-js", "version": "17.1.0", "private": true, "homepage": "10.0.0.130", "dependencies": { "@reduxjs/toolkit": "^1.8.0", "@tanem/react-nprogress": "^4.0.9", "bootstrap": "^4.6.0", "firebase": "^8.3.0", "formik": "^2.2.9", "jquery": "^3.6.0", "nib-core": "2.7.16", "npm": "^7.6.3", "react": "^17.0.1", "react-app-polyfill": "^3.0.0", "react-bootstrap": "^1.5.2", "react-copy-to-clipboard": "^5.0.4", "react-dom": "^17.0.1", "react-nvd3": "^0.5.7", "react-perfect-scrollbar": "^1.5.8", "react-redux": "^7.2.6", "react-router-dom": "^5.2.0", "react-scripts": "4.0.3", "redux": "^4.1.2", "redux-form": "^8.3.8", "rodal": "^1.8.1", "sass": "^1.32.8", "web-vitals": "^1.1.0", "yup": "^0.32.9" }, "scripts": { "start": "PORT=3000 react-scripts --max_old_space_size=8128 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" ] }, "devDependencies": { "prettier": "2.6.0" } }
项目2
{ "name": "datta-able-react-hook-reactstrap-js", "version": "17.1.0", "private": true, "homepage": "10.0.0.130", "dependencies": { "@amcharts/amcharts5": "^5.1.8", "@amcharts/amcharts5-geodata": "^5.0.2", "@auth0/auth0-spa-js": "^1.20.1", "@ckeditor/ckeditor5-build-balloon": "33.0.0", "@ckeditor/ckeditor5-build-classic": "33.0.0", "@ckeditor/ckeditor5-build-decoupled-document": "33.0.0", "@ckeditor/ckeditor5-build-inline": "33.0.0", "@ckeditor/ckeditor5-react": "^4.0.0", "@fullcalendar/core": "^5.10.1", "@fullcalendar/daygrid": "^5.10.1", "@fullcalendar/interaction": "^5.10.1", "@fullcalendar/react": "^5.10.1", "@fullcalendar/timegrid": "^5.10.1", "@reduxjs/toolkit": "^1.8.0", "@tanem/react-nprogress": "^4.0.9", "@testing-library/jest-dom": "^5.16.2", "@testing-library/react": "^12.1.4", "@testing-library/user-event": "^13.5.0", "apexcharts": "^3.33.2", "aphrodite": "^2.4.0", "axios": "^0.26.0", "axios-mock-adapter": "^1.20.0", "bootstrap": "^4.6.0", "chart.js": "^2.9.4", "chroma-js": "^2.4.2", "cropperjs": "^1.5.12", "deni-react-treeview": "^1.1.11", "echarts": "^5.3.1", "echarts-for-react": "^3.0.2", "firebase": "^8.3.0", "formik": "^2.2.9", "highcharts": "^10.0.0", "highcharts-react-official": "^3.1.0", "history": "^5.3.0", "install": "^0.13.0", "jodit": "^3.15.3", "jodit-react": "^1.2.10", "jquery": "^3.6.0", "jsonwebtoken": "^8.5.1", "jwt-decode": "^3.1.2", "match-sorter": "6.3.1", "namor": "^2.0.3", "nib-core": "2.7.16", "npm": "^7.6.3", "pnotify": "4.0.0", "prism-react-renderer": "0.1.7", "rc-slider": "^9.7.5", "rc-tooltip": "^5.1.1", "react": "^17.0.1", "react-animated-tree": "^1.0.10", "react-apexcharts": "^1.4.0", "react-app-polyfill": "^3.0.0", "react-bootstrap": "^1.5.2", "react-bootstrap4-form-validation": "^1.0.10", "react-chartjs-2": "^2.11.1", "react-color": "^2.19.3", "react-compound-timer": "^1.2.0", "react-copy-to-clipboard": "^5.0.4", "react-cropper": "^2.1.8", "react-datepicker": "^4.7.0", "react-datetime": "^3.1.1", "react-dom": "^17.0.1", "react-dropzone-component": "^3.2.0", "react-dual-listbox": "^2.2.0", "react-flot": "^1.3.0", "react-google-charts": "^4.0.0", "react-google-maps": "^9.4.5", "react-icons": "^4.3.1", "react-image-video-lightbox": "2.0.1", "react-image-zoom-hook": "^0.1.13", "react-images": "^1.1.7", "react-images-texts-videos": "^0.0.7", "react-input-mask": "^2.0.4", "react-joyride": "^2.3.2", "react-jvectormap": "^0.0.16", "react-multistep": "^5.1.0", "react-nestable": "^2.0.0", "react-number-format": "^4.9.1", "react-nvd3": "^0.5.7", "react-perfect-scrollbar": "^1.5.8", "react-photo-gallery": "^8.0.0", "react-rating": "^2.0.5", "react-redux": "^7.2.6", "react-router-dom": "^5.2.0", "react-scripts": "4.0.3", "react-select": "^5.2.2", "react-simple-step-wizard": "^1.0.0", "react-slick": "^0.28.1", "react-table": "^7.7.0", "react-tag-autocomplete": "^6.3.0", "react-to-print": "^2.14.4", "react-toast-notifications": "^2.5.1", "react-trello": "^2.2.11", "react-useinterval": "^1.0.2", "reactour": "^1.18.7", "recharts": "^2.1.9", "redux": "^4.1.2", "redux-form": "^8.3.8", "rodal": "^1.8.1", "sass": "^1.32.8", "slick-carousel": "^1.8.1", "styled-components": "^5.3.3", "sweetalert2": "^11.4.4", "sweetalert2-react-content": "^4.2.0", "web-vitals": "^1.1.0", "yup": "^0.32.9" }, "scripts": { "start": "PORT=3001 react-scripts --max_old_space_size=8128 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" ] }, "devDependencies": { "prettier": "2.6.0" } }
已尝试的解决方法(仅对项目1的npm安装有效)
- 执行
npm install --legacy-peer-deps - 执行
npm config set legacy-peer-deps true - 执行
export NODE_OPTIONS=--openssl-legacy-provider - 运行
npm start启动项目
但以上方法无法解决:
- 项目1用yarn安装的问题
- 项目2用npm或yarn安装的问题
请求提供通用解决方案。
内容的提问来源于stack exchange,提问作者ssnoopy2222
相关产品推荐
相关产品推荐

