Open the terminal window and write the following command to install the WordPress blocks package.

Install npm Package

npm i @wordpress/blocks

Install WordPress Blocks Package

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"


Import WordPress block to your JS code


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.

Last Update: August 7, 2023
August 7, 2023 170 Mahbub Alam KhanGeneral, WordPress
Total 0 Votes

Tell us how can we improve this post?

+ = Verify Human or Spambot ?

Back To Top