What to do when yarn upgrade outputs [Usage Error: Couldn’t find a script named “upgrade”.]

This is the message output when you want to update the version of a package and you execute a (not good) command without thinking about it.

$ yarn upgrade [package name]
Usage Error: Couldn't find a script named "upgrade".

This section describes how to check and take action when this message is output.

目次

Checking the version of yarn

Check the version of yarn. This is something we wanted to carry out before running it.

$ yarn --version
3.4.1

Upgrading the package

When the version of yarn is 3.4.1, it changes to the following command, so run yarn up to update it.

$ yarn up [package name]

The yarn upgrade command is for Yarn 1 (Classic), so use yarn up if the version is 2 or higher.

Summary

It is recommended that the version of the CLI is recognised and executed so that the correct commands can be executed.

よかったらシェアしてね!
目次