west build is invalid choice

Hi,

I have installed the nRF Connect SDK v2.0.0 with Visual Studio and can now successfully, build, flash and run the nrf9160 at_client sample application. But when I try to build it from the command line west says that 'build' is an invalid choice. When building from the command line, I select "Open Terminal" from the nRF Connect SDK line in the toolchain manager. Then when I try to build, I get this:

at_client [master●] % west build -b nrf9160dk_nrf9160_ns
usage: west [-h] [-z ZEPHYR_BASE] [-v] [-V] <command> ...
west: error: argument <command>: invalid choice: 'build' (choose from 'init', 'update', 'list', 'manifest', 'diff', 'status', 'forall', 'help', 'config', 'topdir', 'selfupdate')
Any ideas why this is happening?
Thanks
Greg
Parents
  • Hello Greg,

    My name is Ted, and I just recently got this error myself.  I've been building ncs 1.6.1 based sample apps and a custom app for a while now, so `west` generally works as expected.  The error you give here is exactly what I saw when I mistakenly issued my `west build . . .` command outside the directory in which my custom, Zephyr based app lives.

    I don't know how your project directory structure looks, but mine is structured like this:

                                           |
                                          ncs
                                           |
         +-------------+-------------+-----+-----+--------+---------+----------+
         |             |             |           |        |         |          |
    custom_app     bootloader     modules       nrf    nrfxlib    zephyr     .west

    The `west` utility only knows about its "build" option when I invoke west in the directory named custom_app.  I believe this has to do with the way `west` looks for additional python modules when it first starts up.  Because the parent 'ncs' directory is the location I chose to initialize as a 'west workspace', there's a hidden .west directory created there, along side my custom app.  There's a tiny one-line or few-lines config file there which I believe points `west` to some further, Zephyr specific options such as 'build'.

    The reason I can run `west` in any path is that I've added its full path to my environment variable $PATH.

    When you open your terminal from nRF Connect SDK is it clear to you, or can you check which is your current working directory?  That might be the issue causing your error.

    - Ted

Reply
  • Hello Greg,

    My name is Ted, and I just recently got this error myself.  I've been building ncs 1.6.1 based sample apps and a custom app for a while now, so `west` generally works as expected.  The error you give here is exactly what I saw when I mistakenly issued my `west build . . .` command outside the directory in which my custom, Zephyr based app lives.

    I don't know how your project directory structure looks, but mine is structured like this:

                                           |
                                          ncs
                                           |
         +-------------+-------------+-----+-----+--------+---------+----------+
         |             |             |           |        |         |          |
    custom_app     bootloader     modules       nrf    nrfxlib    zephyr     .west

    The `west` utility only knows about its "build" option when I invoke west in the directory named custom_app.  I believe this has to do with the way `west` looks for additional python modules when it first starts up.  Because the parent 'ncs' directory is the location I chose to initialize as a 'west workspace', there's a hidden .west directory created there, along side my custom app.  There's a tiny one-line or few-lines config file there which I believe points `west` to some further, Zephyr specific options such as 'build'.

    The reason I can run `west` in any path is that I've added its full path to my environment variable $PATH.

    When you open your terminal from nRF Connect SDK is it clear to you, or can you check which is your current working directory?  That might be the issue causing your error.

    - Ted

Children
No Data
Related