Error missing list of packages to add to your project – Code Example

Total
0
Shares

Error missing list of packages to add to your project is raised by yarn add command. This happens when you forget to mention a package name. The solution is to use command yarn add package_name.

According to yarn add documentation, the valid syntaxes are –

# To install latest package
yarn add package-name
# To install specific package version
yarn add package-name@1.2.3
# To install package according to tag like latest, beta, alpha-01
yarn add package-name@tag
# To install latest package yarn add package-name # To install specific package version yarn add package-name@1.2.3 # To install package according to tag like latest, beta, alpha-01 yarn add package-name@tag
# To install latest package
yarn add package-name

# To install specific package version
yarn add package-name@1.2.3

# To install package according to tag like latest, beta, alpha-01
yarn add package-name@tag

Suppose you forgot to add package-name in the command and used like this –

yarn add
yarn add
yarn add

Then, it will raise error missing list of packages to add to your project.

yarn add without package raising error missing list of packages to add to your project

How to install all packages in package.json?

When you were using yarn add command without any package name then you might wished to install all packages in package.json, just like npm install.

To install all packages, you can use this command –

yarn install
// Or simply
yarn
yarn install // Or simply yarn
yarn install

// Or simply

yarn
yarn install to install all packages in package.json file

Conclusion

The solution to the error “missing list of packages to add to your project” is to mention the package name in yarn add command like yarn add package_name. In this article we also saw how we can install all the packages in package.json file using yarn install command.