I’m running Node builds on CircleCI, and then deploying the code to AWS with CodeDeploy. There are some necessary symlinks in the project. The symlinks exist and behave properly in the CirceCI container, but it seems that when when CircleCI prepares a bundle to upload to S3, it “flattens” those symlinks, saving the the target of the symlink instead of preserving the symlink.
As reference, we use symlinks for executables to mirror the convention that npm. npm creates symlinks to executables inside modules modules in the node_modules/.bin folder (https://docs.npmjs.com/files/folders#executables). We put symlinks to all of our executables in a bin folder, and many of those links resolve to the symlink in the node_modules/.bin folder.
When those symlinks are flattened, the executables no longer work, because almost all of them use relative requires to pull in files.
Ya, convention probably isn’t the right word; we’re more just mirroring what npm does when it creates symlinks in node_modules/.bin
There are a few reasons we using symlinks instead of modifying $PATH:
We don’t need all the executables inside node_modules/.bin
We want as few steps as possible in setting up a dev environment
We have other non-npm executables, and want all executables required for the application to live in the same location
Either way, though, the symlink flattening is an issue, because running npm install installs symlinks in node_modules/.bin (e.g., browserify -> ../browserify/bin/cmd.js, gulp -> ../gulp/bin/gulp.js), and those executables no longer work when the symlinks are flattened (because of relative requires).
The symlinks are flatten when we zip your app into a bundle. The fix seems to be easy: just change the code to preserve symlink. However, I’m not sure about what will be affected by the change. I’ll look more and give you update.
AFAIK, the only workaround is not using the CodeDeploy integration and using aws cli to do the deployment.