.bashrc no such file or directory

I’m getting this error when trying to use BASH_ENV (trying to use a global package installed with yarn).

/bin/bash: ~/.bashrc: No such file or directory

Any idea how to resolve this?

config.yml snippet, using CircleCI 2

  deploy:
    docker:
      - image: circleci/node:8.9.1
    environment:
       BASH_ENV: ~/.bashrc

If you want to change the path you should use this approach: https://circleci.com/docs/2.0/env-vars/#setting-path

    steps:
      - run: echo 'export PATH=/foo/bin:$PATH' >> $BASH_ENV
      - run: some_program_in_foo_bin

Hello folks, I have tried the strategy @levlaz described above, but for some reason I don’t see this working across workflow steps.
Am I understanding this right? Are VMs provided with BASH_ENV coming from other steps?

To add a bit more info, my container is spinned with the following env var:

BASH_ENV=/tmp/.bash_env-5acbc65f4261820007612b28-0-build

but when I ssh in, I don’t see the file in /tmp

@arichiardi: I seem to recall that filing systems are preserved from one workflow step to another, but maybe /tmp is cleared? Is it worth trying an experimental touch to /root/foo in your first step to see if it is visible in your second step?

I will definitely try that but I am not in control of what goes in BASH_ENV so I wonder why it is created in /tmp if it is then cleared?

Indeed, but we don’t know it is cleared yet - I may be wrong on that :blush:

Ok it seems to me that my configuration does not preserve the file system at all, I tried both:

- run: touch $HOME/foo
- run: touch /tmp/foo

but I don’t see them in subsequent steps, probably the way I configure it is not right.

I don’t use multi-stage workflows, so I might not be much help here. However, perhaps you would post your config file, so that others might see it? I think I read about the preservation of the file system in this forum, but it would be worth confirming that in the docs.

No problem and thanks!

@arichiardi Workspaces might help with what you’re looking for here: https://circleci.com/docs/2.0/workflows/#using-workspaces-to-share-data-among-jobs

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.