0

For a fresh installation, I have removed the node_modules folder using the command rm -rf node_modules/.Then from the terminal I have run npm install in Ubuntu, but now i am getting below error, could someone please advise on what steps should I follow to fix this issue ?

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: @badeball/cypress-cucumber-preprocessor@11.4.0
npm ERR! Found: esbuild@0.15.10
npm ERR! node_modules/esbuild
npm ERR!   dev esbuild@"^0.15.10" from the root project
npm ERR!   peer esbuild@"*" from @bahmutov/cypress-esbuild-preprocessor@2.1.5
npm ERR!   node_modules/@bahmutov/cypress-esbuild-preprocessor
npm ERR!     dev @bahmutov/cypress-esbuild-preprocessor@"^2.1.5" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peerOptional esbuild@"^0.14.23" from @badeball/cypress-cucumber-preprocessor@11.4.0
npm ERR! node_modules/@badeball/cypress-cucumber-preprocessor
npm ERR!   @badeball/cypress-cucumber-preprocessor@"^11.4.0" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: esbuild@0.14.54
npm ERR! node_modules/esbuild
npm ERR!   peerOptional esbuild@"^0.14.23" from @badeball/cypress-cucumber-preprocessor@11.4.0
npm ERR!   node_modules/@badeball/cypress-cucumber-preprocessor
npm ERR!     @badeball/cypress-cucumber-preprocessor@"^11.4.0" 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 /home/den/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/den/.npm/_logs/2022-10-15T03_40_29_742Z-debug-0.log

// package.json

{
  "name": "booktest",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "repository": {
    "type": "git",
    "url": "https://someurl.com"
  },
  "author": "BookTest",
  "license": "UNLICENSED",
  "private": true,
  "scripts": {
    "remove-files": "node removeFiles.js",
    "cucumber-report": "node createreport.js",
    "cypress:open": "cypress open",
    "cy:simpro-run": "cypress run && npm run cucumber-report",
    "cy:rest-api": "cypress run --headless --spec tests/cypress/integration/restapi/**/*.spec.js"
  },
  "devDependencies": {
    "@babel/core": "^7.13.8",
    "@babel/polyfill": "^7.12.1",
    "@babel/preset-env": "^7.13.9",
    "@bahmutov/cypress-esbuild-preprocessor": "^2.1.5",
    "cheerio": "^1.0.0-rc.5",
    "cucumber-html-reporter": "^5.3.0",
    "cypress": "^10.10.0",
    "cypress-dotenv": "^1.2.2",
    "cypress-file-upload": "^4.1.1",
    "cypress-localstorage-commands": "^1.4.1",
    "cypress-wait-until": "^1.7.1",
    "esbuild": "^0.15.10",
    "eslint": "^6.8.0",
    "eslint-config-airbnb": "^18.2.1",
    "eslint-plugin-import": "^2.22.1",
    "eslint-plugin-jsx-a11y": "^6.4.1",
    "eslint-plugin-react": "^7.22.0",
    "fs-extra": "^8.1.0",
    "gulp": "^4.0.2",
    "gulp-autoprefixer": "^7.0.1",
    "gulp-babel": "^8.0.0",
    "gulp-concat": "^2.6.1",
    "gulp-debug": "^4.0.0",
    "gulp-eslint": "^6.0.0",
    "gulp-filter": "^6.0.0",
    "gulp-fs-cache": "^0.1.0",
    "gulp-iconfont": "^10.0.3",
    "gulp-if": "^3.0.0",
    "gulp-livereload": "^4.0.2",
    "gulp-order": "^1.2.0",
    "gulp-sass": "^4.1.0",
    "gulp-sourcemaps": "^2.6.5",
    "gulp-terser": "^1.4.1",
    "gulp-wait": "0.0.2",
    "lazypipe": "^1.0.2",
    "merge-stream": "^2.0.0",
    "node-sass": "^4.14.1"
  },
  "browserslist": [
    "last 2 Chrome versions",
    "last 2 Firefox versions",
    "last 2 Safari versions",
    "last 2 Edge versions",
    "IE 11",
    "last 2 ChromeAndroid versions",
    "last 2 iOS versions",
    "last 2 Samsung versions",
    "last 2 FirefoxAndroid versions"
  ],
  "dependencies": {
    "@badeball/cypress-cucumber-preprocessor": "^11.4.0",
    "@cypress/webpack-preprocessor": "^5.14.0",
    "auth0-js": "^9.14.3",
    "dotenv": "^8.2.0",
    "idb": "^6.0.0",
    "moment": "^2.29.1",
    "papaparse": "^5.3.0",
    "path": "^0.12.7",
    "pdf-parse": "^1.1.1",
    "pdfjs-dist": "^2.6.347"
  }
}
soccerway
  • 10,371
  • 19
  • 67
  • 132

1 Answers1

1

The problem looks like a mis-match of versions, although I couldn't reproduce the same error message.

If you download the @badeball/cypress-cucumber-preprocessor repository file, unzip it and copy the example folder that most closely matches your current setup - looks like /esbuild-cjs is the closest.

If you use that folder as the project root (rename it whatever you want) and npm install to set up node-modules, then look in the node-module folder you will see these versions have been installed.

"cypress": "10.10.0",
"@badeball/cypress-cucumber-preprocessor": "@13.0.2",
"@bahmutov/cypress-esbuild-preprocessor": "@2.1.5"
"esbuild": '0.14.54',

which is fairly close to the recommendation in the error message.

The package.json just has

{
  "devDependencies": {
    "@badeball/cypress-cucumber-preprocessor": "latest",
    "@bahmutov/cypress-esbuild-preprocessor": "latest",
    "cypress": "latest"
  }
}

If you want you can change latest to the specific versions, and add the other packages you need,

but don't add the entry for esbuild because it's correct version is already being installed by @badeball/cypress-cucumber-preprocessor.

Any additions you make to dependencies or devDependencies, you will need to run npm install to update node-modules.

TesterDick
  • 3,830
  • 5
  • 18