Skip to content

Installation using scripts requires fiddling with env vars #1027

@honzajavorek

Description

@honzajavorek

At https://docs.apify.com/cli/docs/installation, the first and most visible, thus I presume the default and preferred way to install the Apify CLI, is the installation scripts. I'm unable to test Windows right now, but I tested installing Apify CLI with a clean user account on my macOS.

It works, but requires me to fiddle with PATH and env vars. This can be an issue for less experienced users. The main installation method gives an impression like it's a matter of executing a single line in the terminal, but in fact it's not. And I don't know the fact until I either:

  1. Notice that I need to modify the PATH in the output of the installation, but the output is so huge, that nobody's gonna really read it unless it crashes on error and they have to – but on the contrary, the output gives an impression that everything is done, ready, and all right.
  2. I go to the next step, try to run apify --version and realize that no such command is present. Then I'm left with debugging why.

Modifying PATH requires the user to navigate the following:

  • Have an idea what PATH is.
  • Have an idea how environment variables work.
  • Know what shell is and which one I use.
  • Know what configuration file my shell uses and where it should be. The output mentions it, but if I don't know much or anything about these topics, I'm lost. On fresh install of macOS the .zshrc file isn't present and one needs to first create it before anything can be added to it.
  • Know how to create file ~/.zshrc and how to work with it. Less experienced user might not know exactly what ~ is or how to work with dotfiles, which are invisible in most scenarios.
  • Know how to put the recommended values to that file by navigating through a text editor.
  • Know that I need to restart or reload my terminal before the change takes effect.

I propose that the installation should detect what shell is being used and at least prompt the user whether they want to add the env vars, with the default set to YES, so a less tech savvy user can be just instructed to confirm everything and use the defaults. But even then, reloading the terminal is still necessary before apify --version will work, so the installation docs should give some guidance around this.


I figured this out when working on apify/apify-docs#2174, but in the end, I won't be installing Apify CLI using the scripts in the course. I need the student to work with Node.js anyway later on, so I'll put them through Node.js installation first and then npm install -g apify-cli. I tested that scenario on fresh macOS install and it's pretty seamless.

Metadata

Metadata

Assignees

No one assigned

    Labels

    t-toolingIssues with this label are in the ownership of the tooling team.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions