'Cannot deploy new v4 strapi project to Heroku or Render - getting “401 Unauthorized” error on fontawesome package request

I am trying to create a brand new strapi v4 project and that works fine locally but when I try and deploy it to Render or Heroku (which I’ve done before many times on Strapi v3) I get a build error when it tries to grab fontawesome-free-5.15.4.tgz from fontawesome. The error log I get on both Render and Heroku is:

error An unexpected error occurred: "https://npm.fontawesome.com/@fortawesome/fontawesome-free/-/5.15.4/fontawesome-free-5.15.4.tgz: Request failed \"401 Unauthorized\"".
       info If you think this is a bug, please open a bug report with the information provided in "/tmp/build_2d005b2a/yarn-error.log".

Is there something I can do to solve the issue? If I go to https://npm.fontawesome.com/@fortawesome/fontawesome-free/-/5.15.4/fontawesome-free-5.15.4.tgz myself, it asks for a username and password so I’m assuming that when Render/Heroku try and hit that URL they don’t have a username and password to send. (And the same goes for all the different npm.fontawesome.com links in the yarn.lock file).

If this is the case, why does the project build and run fine locally? Shouldn’t I also have to input those credentials? Do they need to be added as environment variables on Render/Heroku somehow?

Sorry, I’m quite new to all this! I was following this tutorial on the Strapi blog: https://strapi.io/blog/deploying-a-strapi-api-on-heroku

Any help is greatly appreciated.

Thanks!

P.S. Here is the full error log from Heroku:

-----> Building on the Heroku-20 stack
-----> Determining which buildpack to use for this app
-----> Node.js app detected
       
-----> Creating runtime environment
       
       NPM_CONFIG_LOGLEVEL=error
       USE_YARN_CACHE=true
       NODE_VERBOSE=false
       NODE_ENV=production
       NODE_MODULES_CACHE=true
       
-----> Installing binaries
       engines.node (package.json):  >=12.x.x <=16.x.x
       engines.npm (package.json):   >=6.0.0
       engines.yarn (package.json):  unspecified (use default)
       
       Resolving node version >=12.x.x <=16.x.x...
       Downloading and installing node 16.14.1...
       Bootstrapping npm >=6.0.0 (replacing 8.5.0)...
       npm >=6.0.0 installed
       Resolving yarn version 1.22.x...
       Downloading and installing yarn (1.22.17)
       Installed yarn 1.22.17
       
-----> Installing dependencies
       Installing node modules (yarn.lock)
       yarn install v1.22.17
       [1/4] Resolving packages...
       [2/4] Fetching packages...
       error An unexpected error occurred: "https://npm.fontawesome.com/@fortawesome/fontawesome-free/-/5.15.4/fontawesome-free-5.15.4.tgz: Request failed \"401 Unauthorized\"".
       info If you think this is a bug, please open a bug report with the information provided in "/tmp/build_2d005b2a/yarn-error.log".
       info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
-----> Build failed
       
       We're sorry this build is failing! You can troubleshoot common issues here:
       https://devcenter.heroku.com/articles/troubleshooting-node-deploys
       
       Some possible problems:
       
       - Dangerous semver range (>) in engines.node
         https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
       
       Love,
       Heroku
       
 !     Push rejected, failed to compile Node.js app.
 !     Push failed


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source