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

Created on 2 Nov 2016  路  5Comments  路  Source: yarnpkg/yarn

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.
鈹溾攢 [email protected]                  
鈹溾攢 [email protected]                
鈹斺攢 [email protected]                   
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

cat-bug

Most helpful comment

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) :slightly_smiling_face:

$ 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.

All 5 comments

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) :slightly_smiling_face:

$ 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.

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?

Regarding: https://github.com/yarnpkg/yarn/issues/1609#issuecomment-257907382

FYI: tj/commander.js#483 has been fixed by tj/commander.js#494

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.

Would you please elaborate? I created a project with vue create (chose yarn) and I cannot do yarn add <package> because I get the error Missing list of packages to add to your project.. Manually editing package.json works. Why cannot I add a dependency? npm install <package> works. It also works with yarn when I run it from inside VSCode. Why?!

Was this page helpful?
0 / 5 - 0 ratings