0

I have recently downloaded matterjs using npm using the command npm install matter-js.

I use vscode for my html project. I have a folder called Node. And another folder ( which is automatically generated ) called node-modules.

The folder node-modules is not inside Node folder.

The matter-js module is present inside node-modules.

Now inside my Node folder I created a file called index.html and added this line

<script src="matter.js"></script>

When I start doing my program in the script tag and then tried to run. The console shows that it could not find matter.js file.

What should I do now in order to embed the matter.js module to my html program?

Even in the matterjs docs it was just mentioned to install using npm and then use it in you html. I have done as it is mentioned and still unable to connect.

  • 2
    You should be able to follow the guide from `matter.js`'s website on how to install and how to use it. – Adriano Jul 01 '21 at 06:29

1 Answers1

0

You can use CDN in HTML follow this web site https://cdnjs.com/libraries/matter-js

or you can add this

<script src="https://cdnjs.cloudflare.com/ajax/libs/matter-js/0.17.1/matter.min.js" integrity="sha512-3CP+e7z5ieYYTIyvRvV3eGVYR67yXg5V2mWfg8pEJJd2mlh8tG/cnDv5scTmRztEYHTksBlpPOmxFOiMtHfZdQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
Harsh Shah
  • 1,386
  • 14
  • 19