Wix allows you to install public npm packages directly from the npm registry to your site. This article explains how to install, use, and uninstall npm packages, which can be done in the editor (Wix Studio and Wix Editor), or by using the Wix CLI (Wix Studio) in your local IDE. Note that it's not possible to install npm packages directly to your site using the Wix IDE.
Important: By installing an npm package, you agree to that npm module's license agreement.
Navigate to Packages & Apps in the Code sidebar.
Hover over npm in Packages & Apps, click the plus icon , and then select Install npm package.
This action opens the Package Manager. Note that the 10 most popular npm packages used on Wix sites are displayed in the Package Manager.
In the npm section of the Package Manager, search for the package you want to add to your site. Instructions for how to use the package are displayed on the right side of the Package Manager.
Click Install next to the package of your choice. Once installed, you can find the package under npm in the Packages & Apps section of the Code sidebar.
To install an npm package with the Wix CLI, make sure that your site is connected to Github and that the Wix CLI is installed in your local IDE.
Open the terminal in your local IDE.
Install the package of your choice by running the following command:
Open the package.json
file in your project to see the installed package.
To use an installed package, open your package's README file from the editor. In the Packages & Apps section of the Code sidebar, click on the npm package to view the README file in the Code editor. Alternatively, hover over the package, click the Show More icon, and then select View Documentation to view the npm package documentation in a new browser. Follow the instructions on how to use the package in your code.
You can also search for your package's README file at npmjs.cpm.
Important: After applying a package update, make sure that the code on your site is compatible with the updated version of the package.
In the editor, you can update a package to its latest version, or you can change it to a previous version.
Open the Package Manager and select Installed Packages. To open the Package manager, hover over npm in Packages & Apps, click the plus icon , and then select Install npm package.
Hover over the package and click the button, and then select Choose a version.
Look for the version you want and click Install.
To update a package to its latest version using the Wix CLI, run the following command:
Note: Currently, you can't switch to older versions of your package using the Wix CLI.
Warning: When you uninstall a package, you may inadvertently break code that relies on that package.
Hover over the package you want to uninstall located under npm of the Packages & Apps section, click the Show More icon, and select Uninstall.
The package is removed from the npm section in Packages & Apps of the Code sidebar.
To uninstall a package installed on your site using the Wix CLI, run the following command: