So we have a node.js solution with 3 projects on the same repository on a private GitLab instance.
- 1st -> A Node.js web app that we deploy to a 1st Heroku by ci/cd
- 2nd -> Another Node.js API that we deploy to 2nd Heroku by ci/cd
- 3rd -> A package commonly used by 1st and 2nd package which we want to deploy with both of them
So we npm link the 3rd package with both the first one and the second one.
When we had only the first and second packages, deployment was fine and we didn't have any problem.
Note: We use DPL to do the deployment on Heroku
dpl --provider=heroku --app=$HEROKU_WEB --api-key=$HEROKU_API_KEY --skip_cleanup
But then we triggered deployment of the 3 packages and the deployment fail :
Installing dependencies
Installing node modules
npm ERR! code EEXIST
npm ERR! syscall mkdir
npm ERR! path /tmp/build_4b93de5e/node_modules/ai-validator
npm ERR! errno -17
npm ERR! EEXIST: file already exists, mkdir '/tmp/build_4b93de5e/node_modules/ai-validator'
npm ERR! File exists: /tmp/build_4b93de5e/node_modules/ai-validator
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.
npm ERR! A complete log of this run can be found in:
npm ERR! /tmp/npmcache.BtRYQ/_logs/2020-12-18T09_45_42_167Z-debug.log
-----> Build failed
According to the logs, we have to use npm install --force but on Heroku, we don't have a hand on this.
From there, I've looked up several solutions, I found things about symlinks going wrongs with git but that seems to be solved now within git.
I've mainly found that it isn't possible and that you have to host your package somewhere like npm so it can be found by the Heroku npm install. This solution isn't available for us, as we're not allowed to do so.
It could also be DPL but to be honest I don't know what I can do with that.
So I'm kind of stuck there.
Any idea?