OhNoItsATornahdo Posted August 29, 2017 Share Posted August 29, 2017 I'm developing a game and I plan on using Pixi.js for it. I tried installing Pixi.js on my computer by using the NPM install and it did create the node_modules file but, when I tried implementing Pixi.js into my app.js file, I got an error on the browser saying PIXI is not defined. I assumed this meant that it was still not implemented despite installing it. I even tried starting fresh by creating a new project with npm init and then typing npm install pixi.js. So I tried searching for an installation tutorial and couldn't find anything, so I'm pretty stressed out from all this. Is there something I'm missing? Is there something I'm not doing right? Quote Link to comment Share on other sites More sharing options...
xerver Posted August 30, 2017 Share Posted August 30, 2017 `npm install pixi.js` simply downloads the file into the node_modules directory, it is still up to you to ensure your HTML file loads it (along with your scripts). Quote Link to comment Share on other sites More sharing options...
OhNoItsATornahdo Posted August 30, 2017 Author Share Posted August 30, 2017 19 minutes ago, xerver said: `npm install pixi.js` simply downloads the file into the node_modules directory, it is still up to you to ensure your HTML file loads it (along with your scripts). So if I did this in my HTML file: <script src="node_modules/pixi.js/dist/pixi.js"></script> Should it work? Quote Link to comment Share on other sites More sharing options...
Taz Posted August 30, 2017 Share Posted August 30, 2017 If you copy the file into the same directory as index.html it should work with src="pixi.js" Or you can use something like Browserify to handle using npm modules. Quote Link to comment Share on other sites More sharing options...
xerver Posted August 30, 2017 Share Posted August 30, 2017 12 hours ago, OhNoItsATornahdo said: So if I did this in my HTML file: <script src="node_modules/pixi.js/dist/pixi.js"></script> Should it work? If you are running the server locally on your machine and this translates to a valid url, yes this should work fine. OhNoItsATornahdo 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.