Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error $SHELL environment variable is not set #62

Open
mcshaman opened this issue Nov 6, 2018 · 3 comments
Open

Error $SHELL environment variable is not set #62

mcshaman opened this issue Nov 6, 2018 · 3 comments

Comments

@mcshaman
Copy link

mcshaman commented Nov 6, 2018

Error $SHELL environment variable is not set is thrown when chokidar-cli is run from the official node.js Docker image. This image doesn't appear to set the SHELL environment variable. This can be fixed by setting the environment variable before running a script.

SHELL=/bin/bash node my-script.js

I understand this may not be chokidar-cli issue but it may be worth mentioning it in documentation.

@stephenhebert
Copy link

Setting the shell variable does not seem to resolve the issue. Is there a workaround?

@HW13
Copy link

HW13 commented Apr 6, 2023

Depending on the Docker image, bash may not be installed - for example, node-alpine images.

@stephenhebert, have you tried using a different shell?

SHELL=/bin/sh

@alexandrubau
Copy link

This may be related to this. As per official Docker documentation:

Unlike the shell form, the exec form does not invoke a command shell. This means that normal shell processing does not happen. For example, CMD [ "echo", "$HOME" ] will not do variable substitution on $HOME. If you want shell processing then either use the shell form or execute a shell directly, for example: CMD [ "sh", "-c", "echo $HOME" ]. When using the exec form and executing a shell directly, as in the case for the shell form, it is the shell that is doing the environment variable expansion, not docker.

I've encountered the same error while setting up a docker-compose.yml file and I fixed it using:

  my-service-name:
    build:
      context: ../
      dockerfile: .docker/node/Dockerfile
    volumes:
      - ../:/var/www/html
    environment:
      SHELL: /bin/ash # Fix chokidar-cli error
    command: ["npm", "run", "start:dev:orm"]

And here is my stard:dev:orm command from package.json:

"scripts":
 "start:dev:orm": "chokidar \"orm/**/*.{ts,json}\" -c \"rimraf dist/orm && npm run build:orm\" --initial",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants