Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript

Joshua Hardy
Joshua Hardy
17,204 Points

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,085 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.