Problem installing expo in Debian - does not fail, but does not work (!!)

Hello. I am unable to get expo command working in my Debian 11.

First, I followed a tutorial for Windows - it did not mention the requirement of Watchman. But after installing Watchman and reinstaling expo, it still does not work. I even tried to open a new terminal tab, after finishing the expo installing command, to make sure it was not a problem of not updated environment (which is something I have passed by these last days). It is not. Look at some terminal output:

The command returned zero, apparently showing it did not ended with an error. Still, there is not any command in $PATH for my user that starts with “expo”, except “export”. I expected to find “expo” and maybe “expo-cli”.

During this whole week I have been fighting with this problem. Before trying to install expo, I discovered pnpm, as an alternative to npm. It seemed interesting, and I thought it could solve it. But it brought me another problem: nodejs version needed to be 14+. The Debian 11 repository does not currently have versions 14+ available. But I added a node.js repository here with the command:

# curl -sL | bash - 

I found this solution for nodejs by searching the web, and reading some pages about the problem. This made version 14.20.0 be installed. Fine. But the output shown above was done after this. So it may not be related to the problem.

Any ideas?

Hi @duritia

You should install it globally, not in your project. (This is changing in Expo SDK 46, which is currently in beta with the final version expected in about a week.)

i.e., for now do npm install -g expo-cli

Then, depending on the way nodejs is installed, you should have an expo command in your $PATH.

I’ve not tried it, and in my time on the forums I don’t think I have seen anyone else using it either. So, while I can’t say for sure that it will not work, I would rather stick to npm or yarn. (Actually, I’ve seen some issues with installing expo-cli globally with yarn, so for the globally installed Expo stuff, stick with npm. You can still use yarn for managing your app’s dependencies if you like.)

Try installing expo-cli globally and see if that sorts out the problem. If not, you’ll likely need to update your $PATH to point to npm’s global bin directory.

Try the following to see where that is:

npm bin -g
1 Like

My first try was that, @wodin . And since it did not work, I changed for an user only install. And if I am not in a project folder, npm install <something> will install for all projects inside ~/.local folder, no? The ~/.local/bin is in my $PATH for some other things too.

The output of that is just:


Doing a simple test, it seems not. It will install in the current folder, right? But there is something very strange with the way it is installed in the current folder. The command npm install expo-cli creates a folder named node_modules, with several folders inside it. Specifically, there are only 3 folders which names start with “expo”:


Each one of these folders (and all others inside node_modules) contain a bin folder. But after the command finishes, no change is made to user’s $PATH variable! So, naturally, it will not add anything to available commands.

Inside expo-cli/bin folder there is only one file. And if I execute this file, the output will be:

$ ./node_modules/expo-cli/bin/expo.js --version

$ ./node_modules/expo-cli/bin/expo.js

  Usage: expo [command] [options]

    -V, --version                     output the version number
    --non-interactive                 Fail, if an interactive prompt would be required to continue.
    -h, --help                        output usage information

    init [name]                       Create a new Expo project
    start [path]                      Start a local dev server for the app
    start:web [path]                  Start a Webpack dev server for the web app
    export [path]                     Export the static files of the app for hosting it on a web server
    install [packages...]             Install a module or other package to a project
    run:android [path]                Run the Android app binary locally
    run:ios [path]                    Run the iOS app binary locally
    send [path]                       Share the project's URL to an email address

    login                             Login to an Expo account
    logout                            Logout of an Expo account
    register                          Sign up for a new Expo account
    whoami                            Return the currently authenticated account

    client:install:ios                Install Expo Go for iOS on the simulator
    client:install:android            Install Expo Go for Android on a connected device or emulator

    config [path]                     Show the project config
    doctor [path]                     Diagnose issues with the project
    upgrade [sdk-version]             Upgrade the project packages and config for the given SDK version

    customize:web [path]              Eject the default web files for customization
    prebuild [path]                   Create native iOS and Android project files before building natively.
                                      Learn more.

    publish [path]                    Deploy a project to Expo hosting
    publish:set [path]                Specify the channel to serve a published release
    publish:rollback [path]           Undo an update to a channel
    publish:history [path]            Log the project's releases
    publish:details [path]            Log details of a published release

    build:web [path]                  Build the web app for production

    credentials:manager [path]        Manage your credentials
    fetch:ios:certs [path]            Download the project's iOS standalone app signing credentials
    fetch:android:keystore [path]     Download the project's Android keystore
    fetch:android:hashes [path]       Compute and log the project's Android key hashes
    fetch:android:upload-cert [path]  Download the project's Android keystore

    push:android:upload [path]        Upload an FCM key for Android push notifications
    push:android:show [path]          Log the value currently in use for FCM notifications for this project
    push:android:clear [path]         Delete a previously uploaded FCM credential

    url [path]                        Log a URL for opening the project in Expo Go
    url:ipa [path]                    Log the download URL for the standalone iOS binary
    url:apk [path]                    Log the download URL for the standalone Android binary

    webhooks [path]                   List all webhooks for a project
    webhooks:add [path]               Add a webhook to a project
    webhooks:remove [path]            Delete a webhook
    webhooks:update [path]            Update an existing webhook

    build:ios [path]                  Superseded by eas build in eas-cli
    build:android [path]              Superseded by eas build in eas-cli
    build:status [path]               Superseded by eas build:list in eas-cli
    eject [path]                      Superseded by expo prebuild
    upload:android [path]             Superseded by eas submit in eas-cli
    upload:ios [path]                 Superseded by eas submit in eas-cli
    client:ios [path]                 Superseded by Expo Dev Clients

  Run a command with --help for more info 💡
    $ expo start --help

Notice the output of expo.js says its name is just expo! So, is my problem “just” adding all these bin folders into $PATH? But having so many folders there does not feel right… why are not node_modules/<each module>/bin/* being installed in a single folder, which already is on $PATH, or which will be added to it?

OK, you definitely should install expo-cli (and eas-cli) globally, but it seems that your node installation is set up such that that will be impossible without running the installation as root, which you should not do.

You should remove any node_modules directory and package-lock.json and package.json files that were created from running npm install in directories other than an Expo (or other JavaScript) project directory. (e.g. if you ran it in your home directory, remove them from there.)

When you install npm packages that include scripts/binaries, your PATH will never be altered. You will either have to configure npm to use a directory that is already in your PATH, or probably better, add the directory that npm uses to your PATH.

You can configure npm to install global packages somewhere in your home directory and you can also customise where its bin directory is.

e.g. I do this:

$ mkdir -p ~/.npm-global/{bin,lib}
$ echo "prefix=/home/wodin/.npm-global" >> ~/.npmrc
$ npm prefix -g
$ npm bin -g

Then if I run npm install -g expo-cli it puts the node_modules stuff under ~/.npm-global/lib/node_modules and adds a symlink to ~/.npm-global/bin.

Of course I also added /home/wodin/.npm-global/bin in my PATH.