I’m trying to set up a workflow for my React project. What I want to achieve is to get a job to build the stuff and another one to deploy the master branch to Firebase hosting.
This is what I have so far after several configurations:
The build job always success, but with the deploy I have this error:
#!/bin/bash -eo pipefail
./node_modules/.bin/firebase deploy --token=MYTOKEN
/bin/bash: ./node_modules/.bin/firebase: No such file or directory
Exited with code 1
So, what I understand is that the deploy job is not running in the same place the build was, right?
I’m not sure how to fix that. I’ve read some examples and tried several things, but it doesn’t work. I’ve also read the documentation but I think it’s not very clear how to configure everything… maybe I’m too dumb.
I have not run into this problem myself, but I believe Workspaces can help you here. They are a device to declare a directory as restorable in a job from a prior job in the same Workflow. Take a peek in the manual!
Hey @halfer. Thank you for your help and sorry for my delayed response.
I’ve been trying to get it working with Workspaces but I haven’t had any luck. And it is a real pain to have to commit and push every change to the configuration file to test it on CircleCI.
Not sure if you guys could help me… I’m out of ideas, I’ve tried a lot of things…
This is how my config file looks right now:
I don’t have time to help presently, sorry - maybe in a couple of days. I wonder though whether your save/restore paths need to be absolute, not relative?
A good way to be thorough about this is to make a list of the things you have tried, and then to try them all (again if needs be) so you can find out what error you get in each case.
I’d try these:
relative path, whole project (.)
relative path subfolder (./something)
absolute path, whole project (/app)
absolute path, subfolder (/app/something)
If you can try each of these, and let us know what you get for each, that’d be great. I’d lean towards absolute paths, personally; relative paths feel a bit flakey here.
I am assuming /app is the root checkout dir, so /home/circleci/project looks odd to me. I wonder if the default dir for checkout is /app but the default dir for workspaces is /home/circleci/project? If so, you need to fix one of them.
Yeah! What you can do here is to use a throwaway branch, so you can delete the mess it causes, once you’re done.
Interesting, that looks like it might create a different data structure to @jvlobo’s one. If you are interested, you can see what data structure is produced by a piece of YAML here (this can also help with debugging YAML indentation generally). It can be a tricky format to work with.
If it is wrong, please do fix that post! Readers here are in the habit of copying+pasting code/config they find, so we might as well try to leave behind a trail of working material if we can.