Invalid file mode error when deploying a Node.js application to Cloud Foundry

Trouble

Getting Failed: The resource file mode is invalid: File mode '444' with path... is invalid. Minimum file mode is '0600'

Context

In my case it concerned a file nested in node_modules/.cache.

Solution

The solution was to add a .cfignore file at the root of the application to deploy.

Here is the content of my .cfignore file that solved the issue:

node_modules/.cache

Reference: Deploy a Nodejs App to Cloud Foundry