enriikke / gatsby-gh-pages-action

GitHub Action to build and deploy your Gatsby site to GitHub Pages ❤️🎩
MIT License
295 stars 62 forks source link

How to configure legacy-peer-deps ? #75

Closed dr0i closed 2 years ago

dr0i commented 2 years ago

Running gatsby-gh-pages-action@v2 via github-actions suddenly results in:

Installing your site's dependencies using npm. /usr/local/bin/npm install npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR! npm ERR! While resolving: gatsby-remark-autolink-headers@5.4.0 npm ERR! Found: gatsby@3.14.6 npm ERR! node_modules/gatsby npm ERR! gatsby@"^3.14.6" from the root project npm ERR! peer gatsby@"^3.0.0-next.0" from babel-plugin-remove-graphql-queries@3.14.0 npm ERR! node_modules/babel-plugin-remove-graphql-queries npm ERR! babel-plugin-remove-graphql-queries@"^3.14.0" from gatsby@3.14.6 npm ERR! babel-plugin-remove-graphql-queries@"^3.0.0" from gatsby-plugin-image@1.0.0 npm ERR! node_modules/gatsby-plugin-image npm ERR! gatsby-plugin-image@"^1.0.0" from the root project npm ERR! 1 more (gatsby-plugin-typescript) npm ERR! 19 more (gatsby-plugin-feed, gatsby-plugin-gatsby-cloud, ...) npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer gatsby@"^4.0.0-next" from gatsby-remark-autolink-headers@5.4.0 npm ERR! node_modules/gatsby-remark-autolink-headers npm ERR! gatsby-remark-autolink-headers@"^5.3.0" from the root project npm ERR! npm ERR! Conflicting peer dependency: gatsby@4.24.2 npm ERR! node_modules/gatsby npm ERR! peer gatsby@"^4.0.0-next" from gatsby-remark-autolink-headers@5.4.0 npm ERR! node_modules/gatsby-remark-autolink-headers npm ERR! gatsby-remark-autolink-headers@"^5.3.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.

After some research I think the problem will go away if it would be possible to somehow use npm install --legacy-peer-deps . Is this possible, and how exactly? Or ist there any other solution?

github action snippet:

  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - uses: enriikke/gatsby-gh-pages-action@v2
        with:
          access-token: ${{ secrets.ACCESS_TOKEN }}
          deploy-branch: gh-pages
dr0i commented 2 years ago

Setting node-version to 15 was good in my case. Did this like:

    steps:
      - uses: actions/checkout@v1
      - uses: actions/setup-node@v2
        with:
           node-version: 15
     - uses: enriikke/gatsby-gh-pages-action@v2

As this resolves my issue, I close this issue.