Boss machine project npm ERR! ERESOLVE unable to resolve dependency tree

Boss machine project link
https://www.codecademy.com/paths/back-end-engineer-career-path/tracks/wdcp-22-build-a-back-end-with-express-js/modules/wdcp-22-boss-machine/informationals/bapi-p4-boss-machine

I download the boss machine project then npm install which errors, what should I do next?

Debug log

# npm resolution error report

2022-04-23T16:53:05.380Z

While resolving: [email protected]
Found: [email protected]
node_modules/redux
  dev redux@"^3.7.2" from the root project

Could not resolve dependency:
peer redux@"^4" from [email protected]
node_modules/redux-thunk
  dev redux-thunk@"^2.2.0" from the root project

Fix the upstream dependency conflict, or retry
this command with --force, or --legacy-peer-deps
to accept an incorrect (and potentially broken) dependency resolution.

Raw JSON explanation object:

{
  "code": "ERESOLVE",
  "current": {
    "name": "redux",
    "version": "3.7.2",
    "whileInstalling": {
      "name": "build-apis-boss-machine",
      "version": "1.0.0",
      "path": "/Users/someUser/projects/codecademy/bossMachine"
    },
    "location": "node_modules/redux",
    "isWorkspace": false,
    "dependents": [
      {
        "type": "dev",
        "name": "redux",
        "spec": "^3.7.2",
        "from": {
          "location": "/Users/someUser/projects/codecademy/bossMachine"
        }
      }
    ]
  },
  "currentEdge": {
    "type": "dev",
    "name": "redux",
    "spec": "^3.7.2",
    "from": {
      "location": "/Users/someUser/projects/codecademy/bossMachine"
    }
  },
  "edge": {
    "type": "peer",
    "name": "redux",
    "spec": "^4",
    "error": "INVALID",
    "from": {
      "name": "redux-thunk",
      "version": "2.4.1",
      "whileInstalling": {
        "name": "build-apis-boss-machine",
        "version": "1.0.0",
        "path": "/Users/someUser/projects/codecademy/bossMachine"
      },
      "location": "node_modules/redux-thunk",
      "isWorkspace": false,
      "dependents": [
        {
          "type": "dev",
          "name": "redux-thunk",
          "spec": "^2.2.0",
          "from": {
            "location": "/Users/someUser/projects/codecademy/bossMachine"
          }
        }
      ]
    }
  },
  "strictPeerDeps": false,
  "force": false
}

7 Likes

After some reading found that if I changed package.json lines from

"redux": "^3.7.2",
"redux-thunk": "^2.2.0"

to

"redux": "3.7.2",
"redux-thunk": "2.2.0"

Lots of deprecated warnings however npm install did complete and I could get tests to run. Also these were helpful

29 Likes

I encountered the same problem and would have been stuck were it not for your answer. Thanks for sharing.

2 Likes

Oh man, thank you so much!!! I was really struggling with the same errors until I saw your post!

2 Likes

Thank you for doing the research on this.

This was helpful. thanks !

Thank you so much!!!

Thank you very much! Worked for me

Hello, thank you very much. It was helphul but problem was not fix yet, I mean still to many errors and it seems dosent want to start.

1 Like

When you unzip the file, it could be that you have 2 folders with the same name
project-4-boss-machine-start

within the first one, you may have a package.json file.
Move this file into the second folder.

It should look like so:

image

Then from the terminal, go into the second folder to run npm install
e.g.
C:.…\project-4-boss-machine-start\project-4-boss-machine-start

That worked for me.

1 Like

Just to add a third way to fix it, I was able to get it to work by running :

npm install --legacy-peer-deps

I think that may have been enough, but after that I also ran a couple more commands that I’m not sure are needed, but here they are:

npm update
npm audit fix
1 Like

Another way to fix the issues would be to use Yarn.
Before you install make changes in the webpack file:
module.loaders → module.rules
module.rules.query → module.rules.options,
And add to exports:
mode: ‘development’,
.
Hope this helps if the previous ways didn`t.

Hey guys I have just re-downloaded the file, and made the amendments to the package.json file. Running npm install it went ahead and did it without the errors I was getting initially. However when I run ‘npm run start’, it says its starting ‘node server.js’, then clean exit - waiting for changes before restart. It doesn’t say however, Server listening on port 4001.

Have I done this right?

Wow!! thanks for your help!