Search code examples
reactjstypescriptnetlify

How to Resolve Netlify Error 'Install Dependencies'?


I'm trying to upload a website made with react and typescript, but when I'm on the site to deploy it I have an error during the initialization phase: Error Relatory Error

I don't know why is this happening, just started into react 2 months ago and that's my first time upping a site. My gitignore archive have just 'node_modules', maybe is linked to that error?

Here's the entire repository: text


Solution

  • Granted, the info is elusive and hard to read, but this log basically explains why the error is happening

    npm ERR! Conflicting peer dependency: [email protected]
    npm ERR! node_modules/typescript
    npm ERR!   peerOptional typescript@"^3.2.1 || ^4" from [email protected]
    npm ERR!   node_modules/react-scripts
    npm ERR!     react-scripts@"5.0.1" from the root project
    

    This indicates that react-script v5.0.1 has a dependency of the typescript version of either a higher minor/patch version than 3.2.1, or a higher minor/patch version than 4. But in your package.json, it has typescript with the version of ^5.2.2, consequently causing conflict and therefore throwing error.

    To solve this, you can simply downgrade the typescript to the lower version, such as 4.9.5 by

    1. running npm i [email protected],
    2. Check package.json if typescript is properly updated
    3. test locally,
    4. commit, 5.and finally push.

    In case the above fails, remove the node_modules/ directory and package-lock.json and run npm i again.

    BONUS POINT -- add /node_modules into your .gitignore file!!!