'Add shared lib on Heroku deployment

I have a NodeJS monorepo project like this:


Project:
package.json
 --- reactClient:
    --- package.json
    --- src
    --- public
    --- tsconfig.json

 --- sharedLib:
    --- src
    --- package.json
    --- lib
    --- tsconfig.json

This is my deployment script from Github actions:

name: DeployClientStaging

on:
  push:
    paths:
      - "reactClient/**"
      - "sharedLib/**"
    branches: [staging]

jobs:
  deploy:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2
      - uses: akhileshns/[email protected]
        with:
          heroku_api_key: ${{secrets.HEROKU_API_KEY}}
          heroku_app_name: "api-staging"
          heroku_email: "[email protected]"

I recently added the shared lib in reactClient like this in its package.json:

"@company/sharedlib": "../sharedLib",

But when I run the script to build the application, it fails on Heroic with this message:

-----> Installing dependencies
       Installing node modules (yarn.lock)
       yarn install v1.22.18
       [1/4] Resolving packages...
       error Package "" refers to a non-existing file '"/tmp/sharedLib"'.
       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:
       
       - Node version not specified in package.json
         https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version

What can I do to install the shared lib in the client application?



Sources

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

Source: Stack Overflow

Solution Source