add: Cannot add any module that is also an option.

Do you want to request a feature or report a bug?
Bug

What is the current behavior?
Running yarn add flat results in:

yarn add v0.16.1
error Missing list of packages to add to your project.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

Running yarn add flat assert results in:

yarn add v0.16.1                 
[1/4] Resolving packages...      
[2/4] Fetching packages...       
[3/4] Linking dependencies...    
[4/4] Building fresh packages... 
success Saved lockfile.          
success Saved 3 new dependencies.
├─ assert@1.4.1                  
├─ inherits@2.0.1                
└─ util@0.10.3                   
Done in 0.79s.                   

Same thing happens for any package that shares a name with an option flag.

A current workaround is running yarn add -- flat.

If the current behavior is a bug, please provide the steps to reproduce.

Run yarn add flat in any project.

What is the expected behavior?

Yarn should install the module flat and update package.json and yarn.lock.

Please mention your node.js, yarn and operating system version.
node.js: v6.9.1 and v7.0.0
yarn: v0.16.1
OS: Ubuntu v14.04.4 subsystem on Windows 10 Pro

Author: Fantashit

2 thoughts on “add: Cannot add any module that is also an option.

  1. This might sound obvious but if you are facing this issue, make sure you are not accidentally running yarn add without passing the needed parameters (as the error message suggests) 🙂

    $ yarn add
    yarn add v1.3.2
    error Missing list of packages to add to your project.
    info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
    
  2. This might sound obvious but if you are facing this issue, make sure you are not accidentally running yarn add without passing the needed parameters (as the error message suggests) 🙂

    $ yarn add
    yarn add v1.3.2
    error Missing list of packages to add to your project.
    info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
    

    Wait what parameters to pass?

Comments are closed.