Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

install phaser

How do I install phaser? I downloaded it, but I'm not sure how to install it.

3 Answers

Patrik Horváth
Patrik Horváth
11,110 Points

i think you mean for Node.JS if yes here you are

npm install phaser --save

also tehre you see npm command but use --save flag to save it to your package.json file :)

https://www.npmjs.com/package/phaser

also if npm no work try

npm -v

this is for update npm by the way

npm i -g npm

if no works download Node.JS :) and install it

Caleb Kleveter
MOD
Caleb Kleveter
Treehouse Moderator 37,862 Points

My guess is that you are running this on the front-end. If this is the case, you will want to move the phaser.js file to your project (into the js or javascript folder if you have one), then add it to your project with a script tag in your HTML:

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

Or you could just use the CDN (but you need internet access to when developing your website):

<script src="https://cdnjs.cloudflare.com/ajax/libs/phaser/2.6.2/phaser.js"></script>

Hope this helps!

These are all great ideas, for me personally, when I really am stuck on something I go to the docs I don't know phaser, but reading the docs should be your first go to for help, if the docs are not written well, I'd say find something else.