1
votes

I am trying to push a node application to Bluemix using command

cf push <APP NAME> -c "node app.js"

The node app being pushed has few empty nested directories.

The app has an initialization code which needs those nested directories to exist. It uses them to copy and generate files in the runtime.

Problem :

When I push the app, the empty directories are not pushed[only other files and directories that are no empty are pushed] and hence when the application tries to locate it, it fail with

Error: ENOENT No such file or directory error.

The workaround is to add a random file to each of the directory[ so that they are no more empty] and then it gets pushed to the Bluemix(by Cloud Foundry).

Expectation :

How to push the empty directories while pushing an application to the Bluemix? These directories are empty initially but will be used later to generate and save file or documents when the app runs in Bluemix.

1
Please be aware that using local files it not recommended. If your app crashes or needs to be restarted then those files are gone.data_henrik
Agree. I require this option as when the nodebb application pushed to Bluemix, it creates some temporary initialisation file at this location while running[ not sure about the purpose]. When it does not find the location, it gives RR 25/11 04:27 [29] - error: Error: ENOENT: no such file or directory, scandir '/home/vcap/app/public/uploads/sounds'. So I need to push public folder whenvever I push the nodebb application code after build. But since public folder and all its subfolder were empty, they were not getting added with cf push.Mustansir Ali
As I mentioned in my previous comment, the directories are only used for temporary storage during runtime as it appears to me.But I will keep this tip in mind. Thanks.Mustansir Ali

1 Answers

4
votes

If you have resources that are being ignored when pushing and you don't want them to be ignored, create a .cfignore file and list them there with a ! at the start of their lines:

intermediateFileFolderToIgnore/ !tempFolderToNotIgnore/

You can find the syntax for cfignore/gitignore here.