Рухнул весь проект, ошибки npm
Перенес проект с работы домой. Дома при введении npm i вышла ошибка, что проекту требуется babel. В зависимости добавил строку "babel-loader": "8.1.0" - это помогло.
Когда вернулся на работу и сделал git pull, то рухнул весь проект. Не помогают удаления папки с модулями и локов, ни вышеупомянутого babel, ни клонирование проекта с репозитория. Понимаю, что могу дописать ключ --force, но хочется это всё дело "культурно" починить. Что конкретно с меня требуется? Ниже публикую весь package.json и лог ошибок.
{
"name": "portfolio",
"version": "0.1.0",
"private": true,
"dependencies": {
"@cypress/webpack-dev-server": "^1.4.0",
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"@types/jest": "^26.0.15",
"@types/node": "^12.0.0",
"@types/react": "^17.0.0",
"@types/react-dom": "^17.0.0",
"@types/react-redux": "^7.1.18",
"@types/react-router": "^5.1.15",
"axios": "^0.21.1",
"lodash": "^4.17.21",
"moment": "^2.29.1",
"moment-timezone": "^0.5.33",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-redux": "^7.2.4",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.3",
"react-transition-group": "^4.4.2",
"redux": "^4.1.0",
"redux-thunk": "^2.3.0",
"sass": "^1.35.1",
"styled-components": "^5.3.0",
"typescript": "^4.1.2",
"web-vitals": "^1.0.1",
"babel-loader": "8.1.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"test:cy": "cypress open",
"storybook": "start-storybook -p 6006 -s public",
"build-storybook": "build-storybook -s public"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
],
"overrides": [
{
"files": [
"**/*.stories.*"
],
"rules": {
"import/no-anonymous-default-export": "off"
}
}
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"@babel/core": "^7.14.8",
"@babel/preset-env": "^7.14.8",
"@babel/preset-react": "^7.14.5",
"@babel/preset-typescript": "^7.14.5",
"@cypress/react": "^5.9.2",
"@storybook/addon-actions": "^6.3.7",
"@storybook/addon-essentials": "^6.3.7",
"@storybook/addon-links": "^6.3.7",
"@storybook/node-logger": "^6.3.7",
"@storybook/preset-create-react-app": "^3.2.0",
"@storybook/react": "^6.3.7",
"@types/enzyme": "^3.10.9",
"@types/react-router-dom": "^5.1.8",
"cypress": "^8.0.0",
"enzyme": "^3.11.0"
}
}
$ npm i
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR! react@"^17.0.2" from the root project
npm ERR! peer react@"^=16.x || ^=17.x" from @cypress/[email protected]
npm ERR! node_modules/@cypress/react
npm ERR! dev @cypress/react@"^5.9.2" from the root project
npm ERR! 30 more (react-dom, @storybook/addon-actions, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"15.x || 16.x || 16.4.0-alpha.0911da3" from @reach/[email protected]
npm ERR! node_modules/@storybook/api/node_modules/@reach/router
npm ERR! @reach/router@"^1.3.4" from @storybook/[email protected]
npm ERR! node_modules/@storybook/api
npm ERR! @storybook/api@"6.3.7" from @storybook/[email protected]
npm ERR! node_modules/@storybook/addon-actions
npm ERR! dev @storybook/addon-actions@"^6.3.7" from the root project
npm ERR! 1 more (@storybook/addon-essentials)
npm ERR! 10 more (@storybook/addon-essentials, @storybook/addons, ...)
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 /home/user/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/user/.npm/_logs/2021-08-23T05_57_35_443Z-debug.log
Ответы (1 шт):
стоит [email protected] а пакеты требуют ниже
peer react@"15.x || 16.x || 16.4.0-alpha.0911da3" from @reach/[email protected]
сделать даунгрейд реакта, либо с пакетами разобарться
"react": "^17.0.2" в зависимостях 17 реакт стоит, запроси пониже и пересобери.