Search code examples
ruby-on-railsnode.jsubuntunpmforestadmin

Lumber: Command 'lumber' not found


I just setup a Rails Application in my Ubuntu 18 machine, and I want to connect it to Forest Admin. However, Forest Admin requires that I set up a Node Application using npm first. The node application requires the installation of Lumber CLI tool in order to install Forest Admin.

I have however installed Lumber CLI tool by running the command below:

npm install -g lumber-cli@latest -s

When I run the command below npm lumber -version in my command line terminal, I get the response:

6.13.4

But when I try to generate the Forest Admin using the command below:

lumber generate "my_project"...

I get the following error:

Command 'lumber' not found

I need some help. Thank you.


Solution

  • Here's how I solved it:

    The issue is because NPM does not have the write access to the directory that will contain the package you want to install (here lumber-cli).

    To solve this issue, override the default directory where your global NPM packages will be stored:

    mkdir ~/.npm-global
    

    Then, configure NPM to use this directory instead of the default one:

    npm config set prefix '~/.npm-global'
    

    Then, make the node executables accessible from your PATH. To do so, export the environment variable PATH by opening or creating the file ~/.profile and add this line at the end:

    export PATH=~/.npm-global/bin:$PATH
    

    Finally, reload the ~/.profile file:

    source ~/.profile
    

    Try installing lumber cli again using the command below:

    npm install -g lumber-cli@latest -s
    

    It should be able to install lumber without any error, and also display the directory where lumber-cli is installed.

    Reference: Prevent permission errors at installation

    That's all

    I hope this helps