Open the terminal window and write the following command to install the WordPress blocks package.
Install npm Package
npm i @wordpress/blocks
Import-Package To JavaScript Code
Write the following code to your index.js file. You need to add the import code before calling the function.
import {registerBlockType} from "@wordpress/blocks"
You only need this npm package to compile all JavaScript and SCSS files. This npm package does not support older versions of Node and npm. Please check the node and npm versions before running this command. You must install Node.js 14.0.0 or later and npm 6.14.4 or later on your computer to run the scripts.