I created a new plugin for a WordPress project using @wordpress/scripts in my local environment. After I finished and ran the command npm run plugin-zip it generated the zip file but couldn't be installed on the production, saying:

"The package could not be installed. No valid plugins were found."

The problem is the node_modules folder is so big, and zipping the full plugin and uploading it doesn't feel correct to me. How can I move only the built folder of the plugin to the production site?

  • I'm currently working on a site where the previous developer included node_modules in the theme and then went even further by dropping their own scripts into sub-directories within... ..makes updating things a nightmare. You should be able to structure your 'build' so that it outputs the finished, compiled plugin into it's own separate folder, so the none of the node.js modules need to be included. Commented Apr 24 at 19:14

1 Answer 1


For some reason npm run plugin-zip only ZIP the build file and that's not enough for a plugin.

I created my ZIP file manually by moving the build folder and index.php to a new folder and zip them. And that fixed the issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.